diff --git a/commander/commander-tests.ts b/commander/commander-tests.ts index f6f3918f6a..78bd873782 100644 --- a/commander/commander-tests.ts +++ b/commander/commander-tests.ts @@ -79,6 +79,13 @@ program console.log('unknown option is allowed'); }); +program + .version('0.0.1') + .arguments(' [env]') + .action(function (cmd, env) { + console.log(cmd, env); + }); + program.parse(process.argv); console.log('stuff'); diff --git a/commander/index.d.ts b/commander/index.d.ts index e082fcebb2..15a3246710 100644 --- a/commander/index.d.ts +++ b/commander/index.d.ts @@ -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.