diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 10b75382b5..7ba6dbdba5 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -134,6 +134,22 @@ function Argv$options() { ; } +function command() { + var argv = yargs + .usage('npm ') + .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]"); diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index 0e42090fcd..8bfe8f6f95 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -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;