function Argv$choices() { // example from documentation var argv = yargs .alias('i', 'ingredient') .describe('i', 'choose your sandwich ingredients') .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) .help('help') .argv }
function Argv$choices() { // example from documentation let argv = yargs .alias('i', 'ingredient') .describe('i', 'choose your sandwich ingredients') .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) .help('help') .argv; yargs .choices('i', [undefined, true, 'asdf', 'test']) .choices({ test: [undefined, true, 'test-value'] }); }
function Argv$options() { var argv1 = yargs .options('f', { alias: 'file', default: '/etc/passwd', defaultDescription: 'The /etc/passwd file', group: 'files', normalize: true, global: false, array: true, nargs: 3 }) .argv ; var argv2 = yargs .alias('f', 'file') .default('f', '/etc/passwd') .argv ; }
function Argv$options() { let argv1 = yargs .options('f', { alias: 'file', default: '/etc/passwd', defaultDescription: 'The /etc/passwd file', group: 'files', normalize: true, global: false, array: true, nargs: 3, implies: 'other-arg', conflicts: 'conflicting-arg', }) .argv ; let argv2 = yargs .alias('f', 'file') .default('f', '/etc/passwd') .argv ; }
Object.keys(shorthands).forEach((key) => { yargs.alias(key, shorthands[key]); });