Esempio n. 1
0
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
}
Esempio n. 2
0
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']
        });
}
Esempio n. 3
0
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
		;
}
Esempio n. 4
0
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
        ;
}
Esempio n. 5
0
Object.keys(shorthands).forEach((key) => {
	yargs.alias(key, shorthands[key]);
});