Add arguments to commander ICommand interface

This commit is contained in:
Nico Jansen 2016-11-18 10:28:34 +01:00
parent d6c68f5dcb
commit c8b4fd92cb
2 changed files with 12 additions and 0 deletions

View File

@ -79,6 +79,13 @@ program
console.log('unknown option is allowed');
});
program
.version('0.0.1')
.arguments('<cmd> [env]')
.action(function (cmd, env) {
console.log(cmd, env);
});
program.parse(process.argv);
console.log('stuff');

View File

@ -74,6 +74,11 @@ declare namespace commander {
*/
command(name:string, desc?:string, opts?: any):ICommand;
/**
* Set / get the arguments usage `str`.
*/
arguments(str: string):ICommand;
/**
* Add an implicit `help [cmd]` subcommand
* which invokes `--help` for the given command.