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*/]; }); })
// [END storage_delete_bucket] require(`yargs`) .demand(1) .command( `create <bucket>`, `Creates a new bucket.`, {}, (opts) => createBucket(opts.bucket) ) .command( `list`, `Lists all buckets in the current project.`, {}, listBuckets ) .command( `delete <bucket>`, `Deletes a bucket.`, {}, (opts) => deleteBucket(opts.bucket) ) .example(`node $0 create my-bucket`, `Creates a new bucket named "my-bucket".`) .example(`node $0 list`, `Lists all buckets in the current project.`) .example(`node $0 delete my-bucket`, `Deletes a bucket named "my-bucket".`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/storage/docs`) .help() .strict()
require('yargs') .usage('Usage: $0 [option..]') .example('$0 --the-answer=42') .epilog('copyright 2017') .showHelpOnFail(true, 'Specify --help for available options') .help('h') .alias('h', 'help') // Define arguments for CLI .option('answer', { describe: 'the answer (to what question???)', type: 'number', choices: [0, 42, 111, 666] }) .option('question', { describe: 'the question', type: 'string' }) .option('mood', { describe: 'your current mood', type: 'string' }) .config('cfg-json', '*.json configuration file') .config('cfg-yaml', '*.yaml configuration file', function(configPath) { return require('js-yaml').safeLoad(require('fs').readFileSync(configPath, 'utf-8')); }) // Parse any --cfg value as a JSON document with config //.coerce('cfg', JSON.parse) // Read any FOO_xxx env variable as arcument xxx .env('FOO') .strict()
.wrap(120) .help() .strict() .epilogue( `For more information, see https://cloud.google.com/endpoints/docs`
/** * 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); }
.epilogue(`For more information, see https://cloud.google.com/dlp/docs. Optional flags are explained at https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#InspectConfig`); cli.help().strict().argv; });
.epilogue(`For more information, see https://cloud.google.com/translate/docs`) .help() .strict()
.epilogue(`For more information, see https://cloud.google.com/storage/docs`) .help() .strict()
.epilogue(`For more information, see https://cloud.google.com/dlp/docs`); cli.help().strict().argv; });
require(`yargs`) // eslint-disable-line .demand(1) .command( `create <project> <location> <queue>`, `Create a task.`, {}, (opts) => createTask(opts.project, opts.location, opts.queue) ) .command( `pull <project> <location> <queue>`, `Pull a task.`, {}, (opts) => pullTask(opts.project, opts.location, opts.queue) ) .command( `acknowledge <task>`, `Acknowledge a task.`, {}, (opts) => acknowledgeTask(JSON.parse(opts.task)) ) .example(`node $0 create my-project-id us-central1 my-queue`) .example(`node $0 pull my-project-id us-central1 my-queue`) .example(`node $0 acknowledge '{"name":"projects/my-project-id/locations/us-central1/queues/my-queue/tasks/1234","scheduleTime":"2017-11-01T22:27:53.628279Z"}'`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/cloud-tasks/docs`) .help() .strict()
.epilogue(`For more information, see https://cloud.google.com/datastore/docs`) .help() .strict()
__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*/]; }); })
require(`yargs`) // eslint-disable-line .demand(1) .command( `create <project> <location> <queue>`, `Create a task.`, {}, (opts) => createTask(opts.project, opts.location, opts.queue) ) .command( `pull <project> <location> <queue>`, `Pull a task.`, {}, (opts) => pullTask(opts.project, opts.location, opts.queue) ) .command( `acknowledge <task>`, `Acknowledge a task.`, {}, (opts) => acknowledgeTask(JSON.parse(opts.task)) ) .example(`node $0 create my-project-id us-central1 my-queue`) .example(`node $0 pull my-project-id us-central1 my-queue`) .example(`node $0 acknowledge '{"name":"projects/my-project-id/locations/us-central1/queues/my-queue/tasks/1234","scheduleTime":"2017-11-01T22:27:53.628279Z"}'`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/cloud-tasks/docs`) .help() .strict()