.usage('$0 <cmd> [args]') .command('new <model_file> <name> [-t tags]]', 'Upload and publish a tflite model',
yargs .usage('vbot <-f> | vbot download <--client-key> <--scenario-id>') .command('$0', 'run vbot test from local json file', (yargs) => { return yargs.demandOption(['f']) }) .command('download', 'run vbot test stored in vbot web', (yargs) => { return yargs .option('client-key', {demand: true}) .option('scenario-id', {demand: true}) })
const parseFlags = function() { return yargs .options(FLAGS) .usage(USAGE) .parse() }
yargs .usage('git cactus <command>') .demandCommand(1, 'You need to provide a cactus command') .command('cut [level]', 'cuts a release branch from origin/master', (yargs) => { yargs .positional('level', { choices: ['major', 'minor'], default: 'minor', describe: 'The level of the release' }); }, wrap(cactus.cutReleaseBranch)) .command('tag', 'tags a version on a release branch', () => {}, wrap(cactus.tagVersion)) .group(['upstream'], 'Git Options:') .option('upstream', { default: 'origin', describe: 'Upstream remote name'}) .example('git cactus cut', 'Cuts a new release branch (minor)') .example('git cactus tag', 'Tags a new version (patch)')
parseCommandLine() { let options = this._yargs(process.argv).default('windowsize','800x600').wrap(100); options.usage('Electron command line'); options.alias('ws', 'windowsize').string('ws').describe('ws','set window size (Ex: 800x600)'); options.alias('d', 'debug').boolean('1').describe('1', 'Autostart dev tools'); options.alias('u', 'userdata').string('u').describe('u', 'set userdata directory'); options.alias('v', 'version').boolean('v').describe('v', 'Print the version.'); options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.'); this._args = options.argv; if (this._args.help) { process.stdout.write(options.help()); process.exit(0); } if (this._args.version) { process.stdout.write(`Electron Version : ${process.versions.electron}\n`); process.stdout.write('GLBrowser Version : 0.0.1\n'); process.exit(0); } }
function init (data) { if (data && semver.gt(data.version, version)) { console.log(chalk.red(`------ You're running gloria in version ${version}, the latest version is ${data.version}. Run 'npm install -g gloria' to get the latest version ------`)); } // Using yargs to identify commands and arguments // https://www.npmjs.com/package/yargs require(`yargs`) .commandDir(`../commands`) .alias('v', 'version') .version(require(`../version`)) .help() .usage(`Gloria is a static site generator. Use the command init to get started.`) .epilogue(`For more information, check out the documentation in github.com/gloriajs/gloria`) .argv; }
__awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { options.forEach(function (option) { var commandFunc = option.commandFunc, desc = option.desc, command = option.command, optsFunc = option.optsFunc; yargs.command(command, desc, optsFunc, commandFunc); }); yargs .usage('usage: diat <command> [<args>]') .options({ // global options }) .scriptName('diat') .help() .locale('en') .demandCommand() .strict() .parse(); return [2 /*return*/]; }); })
const parseArgs = function() { return yargs .command('* <srcFolder> <destFolder>') .options(OPTIONS) .usage(USAGE) .strict() .parse() }
yargs .usage('Usage: $0 <token> [options]') .example('$0 eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ') .demand(1)
yargs .usage("Usage: $0 <subcommand> [options]") .command("useradd", "Create a new API user", function(yargs){ var argv = yargs
/** * Parses the provided args. * * @param {string[]} args The args to parse. * * @returns {Object} The parsed args. */ function parseArgs(args) { return yargs .usage('Usage: $0 [options]') .options({ d: { alias: 'difficulty', coerce: arg => { const parsed = Number.parseInt(arg, 10); if (Number.isNaN(parsed)) { throw new Error('Invalid argument: difficulty must be a number'); } return parsed; }, describe: 'Difficulty of the blockchain', type: 'number', }, }) .strict() .parse(args); }
// Parse CLI flags const parseFlags = function() { const flags = yargs .options(FLAGS) .usage(USAGE) .parse() const flagsA = filterObj(flags, isUserFlag) return flagsA }
.usage('$0 <cmd> [args]') .command('new <model_file> <name> [-t tags]]', 'Upload and publish a tflite model',
const parseFlags = function() { return yargs .options(FLAGS) .usage(USAGE) .parse() }
__awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { options.forEach(function (option) { var commandFunc = option.commandFunc, desc = option.desc, command = option.command, optsFunc = option.optsFunc; yargs.command(command, desc, optsFunc, commandFunc); }); yargs .usage('usage: diat <command> [<args>]') .options({ // global options }) .scriptName('diat') .help() .locale('en') .demandCommand() .strict() .parse(); return [2 /*return*/]; }); })