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],
fork icon96
star icon94
watch icon14

-3
fork icon58
star icon858
watch icon12

+ 15 other calls in file

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 () => {
fork icon222
star icon600
watch icon40

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) {
fork icon48
star icon112
watch icon10

+ 11 other calls in file

-4
fork icon30
star icon120
watch icon6

+ 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) {
fork icon25
star icon65
watch icon0

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']
});
fork icon8
star icon36
watch icon10

65
66
67
68
69
70
71
72
73
74
 * `config.push`
 */
getCommandLine = function() {
  cli.enable('version', 'help');

  cli.parse(options);


  return cli.options;
};
fork icon1
star icon10
watch icon1

+ 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]
})
fork icon3
star icon0
watch icon0

+ 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],
fork icon0
star icon0
watch icon3