diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 5af27636c..61d84e993 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -123,6 +123,12 @@ function Argv$options() { .options('f', { alias: 'file', default: '/etc/passwd', + defaultDescription: 'The /etc/passwd file', + group: 'files', + normalize: true, + global: false, + array: true, + nargs: 3 }) .argv ; @@ -134,6 +140,36 @@ function Argv$options() { ; } +function Argv$global() { + var argv = yargs + .global('foo') + .global(['bar', 'baz', 'fizz', 'buzz']) +} + +function Argv$group() { + var argv = yargs + .group('foo', 'foogroup') + .group(['bing', 'bang', 'buzz'], 'onomatopoeia') +} + +function Argv$env() { + var argv = yargs + .env('YARGS_PREFIX_') + .env() +} + +function Argv$array() { + var argv = yargs + .array('foo') + .array(['bar', 'baz']) +} + +function Argv$nargs() { + var argv = yargs + .nargs('foo', 12) + .nargs({'bing': 3, 'bang': 2, 'buzz': 4}) +} + function Argv$choices() { // example from documentation var argv = yargs @@ -241,7 +277,7 @@ function Argv$locale() { function Argv$epilogue() { var argv = yargs - .epilogue('for more information, find our manual at http://example.com'); + .epilogue('for more information, find our manual at http://example.com'); } function Argv$reset() { diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index 02f6a43ae..66d50d040 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -23,6 +23,7 @@ declare module "yargs" { alias(aliases: { [shortName: string]: string[] }): Argv; array(key: string): Argv; + array(keys: string[]): Argv; default(key: string, value: any): Argv; default(defaults: { [key: string]: any}): Argv; @@ -114,6 +115,7 @@ declare module "yargs" { group(keys: string[], groupName: string): Argv; nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; /* Undocumented */ @@ -138,9 +140,9 @@ declare module "yargs" { require?: any; default?: any; defaultDescription?: string; - boolean?: any; - string?: any; - count?: any; + boolean?: boolean; + string?: boolean; + count?: boolean; describe?: any; description?: any; desc?: any; @@ -148,10 +150,7 @@ declare module "yargs" { choices?:string[]; global?: boolean; array?: boolean; - boolean?: boolean; config?: boolean; - count?: boolean; - string?: boolean; number?: boolean; normalize?: boolean; nargs?: number;