From c8b4fd92cbe3bb02fc657ca58c9bd9bfbb1e7380 Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Fri, 18 Nov 2016 10:28:34 +0100 Subject: [PATCH] Add arguments to commander ICommand interface --- commander/commander-tests.ts | 7 +++++++ commander/index.d.ts | 5 +++++ 2 files changed, 12 insertions(+) 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.