How to use cli.glob:
GitHub: wspringer/hashmark
47 48 49 50 51 52 53 54 55 56
var files = process.stdin; if (cli.options.name) { files.fileName = cli.options.name; } if (cli.args.length) { files = cli.glob.sync(cli.args[0]); } hash(files, cli.options).on('end', function (map) { // Output hash if (!cli.options.silent) {
How to use cli.warn:
GitHub: JoeBartelmo/goddard
60 61 62 63 64 65 66 67 68 69
cmd += '! queue ! omxh264enc bitrate=' + options.bitrate + ' ! mp4mux ! queue ! filesink location=' + options.filename + '-' + cameraInfo.name.replace(/ /g, '') + '.mp4'; cli.info(cmd) defer.resolve(cmd); } else { cli.warn('Unknown Camera ' + camera +'. Register in knownCameras.json'); defer.resolve(undefined); } }); gstCommands.push(defer.promise);
How to use cli.args:
GitHub: keithamus/hashmark
60 61 62 63 64 65 66 67 68 69
var files = process.stdin; if (cli.options.name) { files.fileName = cli.options.name; } if (cli.args.length) { files = cli.args.reduce(function(files, pattern) { return files.concat(cli.glob.sync(path.join(cli.options.cwd, pattern))); }, []); } hash(files, cli.options).on('end', function (map) {
See more examples
How to use cli.output:
GitHub: genintho/html-minifier
187 188 189 190 191 192 193 194 195 196
cli.exit(status); } if (options.version) { cli.output(appName + ' v' + appVersion); cli.exit(0); } if (options['config-file']) {
See more examples
How to use cli.enable:
63 64 65 66 67 68 69 70 71
* use a [cli](https://www.npmjs.com/package/cli) instance to * handle fancy cli stuff. Also attach options defined in other modules using * `config.push` */ getCommandLine = function() { cli.enable('version', 'help'); cli.parse(options);
How to use cli.exec:
GitHub: rutaihwa/babu
18 19 20 21 22 23 24 25 26
Cli.info('Cloning the base project ...'); var Cmd = 'git clone ' + Internals.repo + ' ' + destination; Cli.exec(Cmd, callback, callback); }; Internals.updateProject = function (name, destination) {
How to use cli.main:
108 109 110 111 112 113 114 115 116 117
cli.parse({ chapter: ['c', 'New chapter to create', 'int'], }); cli.main(function main(args, options) { cli.failWith = failWith(this); if (args.length !== 1 || args[0] !== 'new') { cli.failWith(`Unknown command: ${args.join(' ')}`);
See more examples
How to use cli.exit:
GitHub: jantimon/html-minifier
164 165 166 167 168 169 170 171 172 173
minifyOptions = fileOptions; } } catch (e) { process.stderr.write('Error: Cannot read the specified config file'); cli.exit(1); } } mainOptionKeys.forEach(function(key) {
See more examples
How to use cli.progress:
GitHub: node-js-libs/cli
0 1 2 3 4 5 6 7 8 9
#!/usr/bin/env node var cli = require('cli'); var i = 0, interval = setInterval(function () { cli.progress(++i / 100); if (i === 100) { clearInterval(interval); cli.ok('Finished!'); }
See more examples
How to use cli.failWith:
116 117 118 119 120 121 122 123 124 125
if (args.length !== 1 || args[0] !== 'new') { cli.failWith(`Unknown command: ${args.join(' ')}`); } if (!options.chapter) { cli.failWith('Missing required Chapter'); } if (readDir(__dirname).includes(`ch${options.chapter}`)) { cli.failWith(`Chapter ${options.chapter} already exists`);
See more examples
How to use cli.options:
GitHub: keithamus/hashmark
57 58 59 60 61 62 63 64 65 66
cli.getUsage(1); } else { cli.options.pattern = cli.args.pop(); var files = process.stdin; if (cli.options.name) { files.fileName = cli.options.name; } if (cli.args.length) { files = cli.args.reduce(function(files, pattern) { return files.concat(cli.glob.sync(path.join(cli.options.cwd, pattern)));
See more examples
How to use cli.getUsage:
20 21 22 23 24 25 26 27 28
options = cli.parse({ now: ['n', 'Run sync on start'] }); if(cli.args.length !== 1) { return cli.getUsage(); } /* Configuration */
See more examples
How to use cli.debug:
GitHub: vishaltelangre/music-dl
40 41 42 43 44 45 46 47 48 49
resolve({listTitle: data.listTitle, trackList}); } catch (error) { reject(`Error while parsing the list of tracks on the provided link`); } }) .log(message => { process.env.DEBUG && cli.debug(message); }) .error(err => { if (err.match(/no results/)) reject("Couldn't find any tracks on the provided link") else
See more examples
How to use cli.spinner:
GitHub: mozilla/qbrt
60 61 62 63 64 65 66 67 68 69
.then(() => { cli.spinner(chalk.green.bold('✓ ') + 'Installing XUL app … done!', true); }) .catch(error => { exitCode = 1; cli.spinner(chalk.red.bold('✗ ') + 'Installing XUL app … failed!', true); console.error(error); }) .finally(() => { process.exit(exitCode);
See more examples
How to use cli.ok:
87 88 89 90 91 92 93 94 95
if (existingScope == null) await Scope.create({ userId: options.id, type }) } catch (e) { console.log(e) } } cli.ok(`User with id ${options.id} made an admin` ); } else { cli.ok(`User with id ${options.id} does not exist`) }
See more examples
How to use cli.fatal:
96 97 98 99 100 101 102 103
process.exit(0); } catch (err) { console.log(err); cli.fatal(err); } });
See more examples
How to use cli.parse:
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],
See more examples
How to use cli.info:
94 95 96 97 98 99 100 101 102 103
const build = options => { settings = options if (options.display) { cli.info(`Path: ${path.resolve(options.cwd, options.src)}`) cli.info(`Pattern: ${options.filePattern}`) cli.info(`Ignored: ${options.ignore}`) cli.info(`Metadata: ${options.metadata}`) } const distFolder = path.resolve(
See more examples
How to use cli.error:
GitHub: icecrime/docker-mon
34 35 36 37 38 39 40 41 42 43
return func(cli.args); } utils.GetAllContainers(host, function (err, containers){ if (err) { return cli.error(err); } return func(containers); });
See more examples