How to use the parse function from cli
Find comprehensive JavaScript cli.parse code examples handpicked from public code repositorys.
7 8 9 10 11 12 13 14 15 16
const awsConfigHelper = require('./util/awsConfigHelper'); const wait = require('./util/wait'); const AWS = require('aws-sdk'); const cli = require('cli'); const cliArgs = cli.parse({ region: ['r', 'AWS region', 'string'], filterName: ['f', 'Pass filter name to filter Lambda functions', 'string'], alarmActionArn: ['a', "Action to be trigger when alarm is breached", "string"], duration: ['d', 'Duration for alarm to check the invocation count', "number", 60],
96
94
14
20 21 22 23 24 25 26 27 28 29
db.url = process.env.MYSQL_URL ?? `mysql://${db.username}:${db.password}@${db.host}:${db.port}/${db.database}`; cli.enable('status'); const options = cli.parse({ id: [false, 'ID of user to make admin', 'string'] }); cli.main(async () => {
222
600
40
15 16 17 18 19 20 21 22 23 24
cli .enable('version') .setApp(pkg.name, pkg.version) .setUsage(cli.app + ' [OPTIONS] <path to json config>'); options = cli.parse({ now: ['n', 'Run sync on start'] }); if(cli.args.length !== 1) {
48
112
10
+ 11 other calls in file
104 105 106 107 108 109 110 111 112 113
}); // NOTE Override the `getUsage` method of the cli which is... not satisfactory. cli.getUsage = () => { console.error(usage); cli.exit(0); }; // eslint-disable-line no-console cli.parse({ chapter: ['c', 'New chapter to create', 'int'], }); cli.main(function main(args, options) {
25
65
0
9 10 11 12 13 14 15 16 17
, eos = require('end-of-stream'); var cli = require('cli') .enable('glob'); var options = cli.parse({ output: ['o', 'Specify output folder', 'path', './db'], quiet: ['q', 'Do not show progress information'] });
8
36
10
65 66 67 68 69 70 71 72 73 74
* `config.push` */ getCommandLine = function() { cli.enable('version', 'help'); cli.parse(options); return cli.options; };
1
10
1
+ 9 other calls in file
7 8 9 10 11 12 13 14 15
* it defaults to 70/25, which is often too small. */ cli.width = 80 cli.option_width = 35 let options = cli.parse({ path: ['p', 'Path to Steam installation.', 'path', null], user: ['u', 'User to switch to by account name or display name.', 'string', null] })
3
0
0
+ 3 other calls in file
21 22 23 24 25 26 27 28 29 30
const cluster = require('cluster'); cli.enable('version'); cli.setApp('bin/server.js', pkg.version); const cliOptions = cli.parse({ port: ['p', 'Websocket port to use instead of autodiscover', 'int', null], web: ['w', 'Port for the website to use', 'int', null], nobonjour: [false, 'Disable bonjour to let clients connect by the server address', 'bool', false], disableRestart: [false, 'Disable auto-restart of server if it crashes', 'bool', false],
0
0
3