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); } }
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`)
function getYargsParser() { return yargs .help() .alias("h", "help") .updateStrings({ 'Positionals:': 'Arguments:', 'Not enough non-option arguments: got %s, need at least %s': "Error: Missing argument <action> (%s/%s)" }) .version(false) .wrap(90) .command( "* <action> [source-path]", `Debug an OpenWhisk <action> by forwarding its activations to a local docker container that has debugging enabled and its debug port exposed to the host. If only <action> is specified, the deployed action code is debugged. If [source-path] is set, it must point to the local action sources which will be mounted into the debug container. Sources will be automatically reloaded on each new activation. This feature depends on the kind. Supported kinds: - ${getSupportedKinds().join("\n")} `, yargsOptions ); }
// [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()
.wrap(120) .help() .strict()
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');
.example(`node $0 infoTypes GOVERNMENT`) .example(`node $0 categories`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/dlp/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`)
.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() .epilogue(`For more information, see https://cloud.google.com/storage/docs`)
.wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/dlp/docs.`)
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`);
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()
`Queries a public Shakespeare dataset.` .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/bigquery/docs`);
.example(`node $0 insert "my-instance" "my-database"`) .example(`node $0 read "my-instance" "my-database"`) .wrap(120) .recommendCommands() .epilogue(`For more information, see https://cloud.google.com/spanner/docs`)
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()