From 5974b1be295ed7f61ff611459bc06a56cb35fd0c Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 29 Dec 2015 11:16:13 -0600 Subject: [PATCH 1/2] Fix minimist.Opts.alias possible values (to match minimist docs/functionality) --- minimist/minimist.d.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/minimist/minimist.d.ts b/minimist/minimist.d.ts index abbc5f028..de767fa4c 100644 --- a/minimist/minimist.d.ts +++ b/minimist/minimist.d.ts @@ -9,20 +9,17 @@ declare module 'minimist' { module minimist { export interface Opts { // a string or array of strings argument names to always treat as strings - // string?: string; string?: string|string[]; // a string or array of strings to always treat as booleans - // boolean?: string; boolean?: boolean|string|string[]; // an object mapping string names to strings or arrays of string argument names to use - // alias?: {[key:string]: string}; - alias?: {[key:string]: string[]}; + alias?: {[key:string]: string|string[]}; // an object mapping string argument names to default values default?: {[key:string]: any}; // when true, populate argv._ with everything after the first non-option stopEarly?: boolean; // a function which is invoked with a command line parameter not defined in the opts configuration object. - // If the function returns false, the unknown option is not added to argv + // If the function returns false, the unknown option is not added to argv unknown?: (arg: string) => boolean; // when true, populate argv._ with everything before the -- and argv['--'] with everything after the -- '--'?: boolean; From 57888a3a478e3cb0d0cb10c778f794df99c0a1af Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 29 Dec 2015 17:12:20 -0600 Subject: [PATCH 2/2] Add test for alias with single string value --- minimist/minimist-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/minimist/minimist-tests.ts b/minimist/minimist-tests.ts index 2266d2739..efd3076aa 100644 --- a/minimist/minimist-tests.ts +++ b/minimist/minimist-tests.ts @@ -19,6 +19,9 @@ opts.boolean = strArr; opts.alias = { foo: strArr }; +opts.alias = { + foo: str +}; opts.default = { foo: str }; @@ -29,7 +32,7 @@ opts.unknown = (arg: string) => { if(/xyz/.test(arg)){ return true; } - + return false; }; opts.stopEarly = true;