add tests, correct some options

This commit is contained in:
Drew Hays
2016-03-14 21:10:41 -07:00
parent c458f90930
commit b05e08bde0
2 changed files with 42 additions and 7 deletions
+37 -1
View File
@@ -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() {
+5 -6
View File
@@ -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;