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)')
require(`yargs`) .demand(1) .command( `readOnly <instanceName> <databaseName>`, `Execute a read-only transaction on an example Cloud Spanner table.`, {}, (opts) => readOnlyTransaction(opts.instanceName, opts.databaseName) ) .command( `readWrite <instanceName> <databaseName>`, `Execute a read-write transaction on an example Cloud Spanner table.`, {}, (opts) => readWriteTransaction(opts.instanceName, opts.databaseName) ) .example(`node $0 readOnly "my-instance" "my-database"`) .example(`node $0 readWrite "my-instance" "my-database"`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/spanner/docs`)
// [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()
yargs .usage('Usage: $0 <token> [options]') .example('$0 eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ') .demand(1) .number('port')
cli .demand(1) .command('create <sinkName> <bucketName> [filter]', 'Creates a new sink with the given name to the specified bucket with an optional filter.', {}, function (options) { program.createSink(options.sinkName, options.bucketName, options.filter, utils.makeHandler(false)); }) .command('get <sinkName>', 'Gets the metadata for the specified sink.', {}, function (options) { program.getSinkMetadata(options.sinkName, utils.makeHandler()); }) .command('list', 'Lists all sinks.', {}, function () { program.listSinks(utils.makeHandler(true, 'id')); }) .command('update <sinkName> <filter>', 'Updates the filter for the specified sink.', {}, function (options) { program.updateSink(options.sinkName, options.filter, utils.makeHandler(false)); }) .command('delete <sinkName>', 'Deletes the specified sink.', {}, function (options) { program.deleteSink(options.sinkName, utils.makeHandler(false)); }) .example('node $0 create export-errors app-error-logs', 'Create a new sink named "export-errors" that exports logs to a bucket named "app-error-logs".') .example('node $0 get export-errors', 'Get the metadata for a sink name "export-errors".') .example('node $0 list', 'List all sinks.') .example('node $0 update export-errors "severity >= WARNING"', 'Update the filter for a sink named "export-errors".') .example('node $0 delete export-errors', 'Delete a sink named "export-errors".') .wrap(120) .recommendCommands() .epilogue('For more information, see https://cloud.google.com/logging/docs');
require(`yargs`) .demand(1) .command( `createDatabase <instanceName> <databaseName>`, `Creates an example database with two tables in a Cloud Spanner instance.`, {}, (opts) => createDatabase(opts.instanceName, opts.databaseName) ) .command( `addColumn <instanceName> <databaseName>`, `Adds an example MarketingBudget column to an example Cloud Spanner table.`, {}, (opts) => addColumn(opts.instanceName, opts.databaseName) ) .command( `queryNewColumn <instanceName> <databaseName>`, `Executes a read-only SQL query against an example Cloud Spanner table with an additional column (MarketingBudget) added by addColumn.`, {}, (opts) => queryDataWithNewColumn(opts.instanceName, opts.databaseName) ) .example(`node $0 createDatabase "my-instance" "my-database"`) .example(`node $0 addColumn "my-instance" "my-database"`) .example(`node $0 queryNewColumn "my-instance" "my-database"`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/spanner/docs`)
rotateEncryptionKey .example(`node $0 generate-encryption-key`, `Generate a sample encryption key.`) .example(`node $0 upload my-bucket ./resources/test.txt file_encrypted.txt QxhqaZEqBGVTW55HhQw9Q=`, `Encrypts and uploads "resources/test.txt" to "gs://my-bucket/file_encrypted.txt".`) .example(`node $0 download my-bucket file_encrypted.txt ./file.txt QxhqaZEqBGVTW55HhQw9Q=`, `Decrypts and downloads "gs://my-bucket/file_encrypted.txt" to "./file.txt".`) .example(`node $0 rotate my-bucket file_encrypted.txt QxhqaZEqBGVTW55HhQw9Q= SxafpsdfSDFS89sds9Q=`, `Rotates encryption keys for "gs://my-bucket/file_encrypted.txt".`) .wrap(120) .recommendCommands()
cli .demand(1) .command(`create <datasetId>`, `Creates a new dataset.`, {}, (opts) => { program.createDataset(opts.datasetId); }) .command(`delete <datasetId>`, `Deletes a dataset.`, {}, (opts) => { program.deleteDataset(opts.datasetId); }) .command(`list [projectId]`, `Lists all datasets in the specified project or the current project.`, {}, (opts) => { program.listDatasets(opts.projectId || process.env.GCLOUD_PROJECT); }) .command(`size <datasetId> [projectId]`, `Calculates the size of a dataset.`, {}, (opts) => { program.getDatasetSize(opts.datasetId, opts.projectId || process.env.GCLOUD_PROJECT); }) .example(`node $0 create my_dataset`, `Creates a new dataset named "my_dataset".`) .example(`node $0 delete my_dataset`, `Deletes a dataset named "my_dataset".`) .example(`node $0 list`, `Lists all datasets in the current project.`) .example(`node $0 list bigquery-public-data`, `Lists all datasets in the "bigquery-public-data" project.`) .example(`node $0 size my_dataset`, `Calculates the size of "my_dataset" in the current project.`) .example(`node $0 size hacker_news bigquery-public-data`, `Calculates the size of "bigquery-public-data:hacker_news".`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/bigquery/docs`);
program.queryShakespeare .example( `node $0 sync "SELECT * FROM publicdata.samples.natality LIMIT 5;"`, `Synchronously queries the natality dataset.` .example( `node $0 async "SELECT * FROM publicdata.samples.natality LIMIT 5;"`, `Queries the natality dataset as a job.` .example( `node $0 shakespeare`, `Queries a public Shakespeare dataset.`
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()
(opts) => readData(opts.instanceName, opts.databaseName) .example(`node $0 update "my-instance" "my-database"`) .example(`node $0 query "my-instance" "my-database"`) .example(`node $0 insert "my-instance" "my-database"`) .example(`node $0 read "my-instance" "my-database"`) .wrap(120) .recommendCommands()
(opts) => deleteTask(opts.taskId) .example(`node $0 new "Buy milk"`, `Adds a task with description "Buy milk".`) .example(`node $0 done 12345`, `Marks task 12345 as Done.`) .example(`node $0 list`, `Lists all tasks ordered by creation time`) .example(`node $0 delete 12345`, `Deletes task 12345.`) .wrap(120) .recommendCommands()
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()