const parseFlags = function() { return yargs .options(FLAGS) .usage(USAGE) .parse() }
const parseArgs = function() { return yargs .command('* <srcFolder> <destFolder>') .options(OPTIONS) .usage(USAGE) .strict() .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*/]; }); })
/** * Load argv step adding eventualy file passed by command line * @param nconf - nconf instance * @param options - plugin options */ const loadArgv = (nconf, options) => { if (_.has('disable.argv', options)) return promiseIfNeeded(options); const argOpts = options.argv || {}; // craft own yargs if needed that is transmit to nconf const yargs = _.has('argv', argOpts) ? argOpts : Yargs(process.argv.slice(2)).options(argOpts); yargs.separator = options.separator; if (options.parse !== undefined) yargs.parseValues = options.parse; const transformer = getTransformer(options); if (transformer) yargs.transform = transformer; nconf.argv(yargs); nconf._yargs = yargs; const argvFile = nconf.get('configue'); if (argvFile) { nconf.file('argv-configue', argvFile); } return promiseIfNeeded(options); }
(opts) => streamingMicRecognize(opts.encoding, opts.sampleRate) .options({ encoding: { alias: 'e',
yargs .option('address', { alias: 'a', describe: 'Address for master server to listen on', type: 'string', default: 'tcp://localhost:3000', }) .options('report', { alias: 'r', describe: 'Report interval in ms', type: 'number', default: 10000, }) .options('key', { alias: 'k', describe: 'Path to file that contains SSL certificate key', type: 'string', coerce: arg => arg ? fs.readFileSync(path.resolve(__dirname, arg)) : undefined, }) .options('cert', { alias: 'c', describe: 'Path to file that contains SSL certificate', type: 'string', coerce: arg => arg ? fs.readFileSync(path.resolve(__dirname, arg)) : undefined, }) .help() .alias('help', 'h')
}, }) .options({ 'build-pack': { alias: 'b',
.options({ cloudRegion: { alias: 'c',
.usage('$0 [options] [path/to/wwwroot]') .strict() .options({ 'port' : { 'description' : 'Port to listen on. [default: 3001]',
.options({ cloudRegion: { alias: 'c',
/** * 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 }
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*/]; }); })