Add optional function parameter to command()

This commit is contained in:
Niklas Mollenhauer
2015-10-07 20:56:13 +02:00
parent 66f88ec518
commit 2d69a5f8bf
2 changed files with 17 additions and 0 deletions

View File

@@ -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
View File

@@ -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;