mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08: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]");
|
||||
|
||||
Vendored
+1
@@ -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