mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
Add optional function parameter to command()
This commit is contained in:
@@ -134,6 +134,22 @@ function Argv$options() {
|
||||
;
|
||||
}
|
||||
|
||||
function command() {
|
||||
var argv = yargs
|
||||
.usage('npm <command>')
|
||||
.command('install', 'tis a mighty fine package to install')
|
||||
.command('publish', 'shiver me timbers, should you be sharing all that', yargs => {
|
||||
argv = yargs.option('f', {
|
||||
alias: 'force',
|
||||
description: 'yar, it usually be a bad idea'
|
||||
})
|
||||
.help('help')
|
||||
.argv;
|
||||
})
|
||||
.help('help')
|
||||
.argv;
|
||||
}
|
||||
|
||||
function Argv$help() {
|
||||
var yargs1 = yargs
|
||||
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
|
||||
|
||||
1
yargs/yargs.d.ts
vendored
1
yargs/yargs.d.ts
vendored
@@ -54,6 +54,7 @@ declare module "yargs" {
|
||||
usage(options?: { [key: string]: Options }): Argv;
|
||||
|
||||
command(command: string, description: string): Argv;
|
||||
command(command: string, description: string, fn: (args: Argv) => void): Argv;
|
||||
|
||||
example(command: string, description: string): Argv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user