How to use the optimist.alias function in optimist

To help you get started, we’ve selected a few optimist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Nodeclipse / nodeclipse-1 / org.nodeclipse.ui / templates / copier.js View on Github external
var argv = require('optimist')
// optimist: all one letter parameters maybe stacked after '-'
// all others should be with '--'
// '-cg proj1' becomes '-c -g=proj1', so it should be '-cgn proj1'
			.alias('c','create') .describe('c', 'create project folder and prepare it')
			//.alias('n','eclipse_project_nodeclipse')
			.alias('g','eclipse_project_general')
			.alias('p','prepare').describe('p', 'prepare for import, i.e. add needed `.project` and other `.*` file ')
			.string('n')
			.alias('n','name')   .describe('h', 'project name (default is folder name)')
			.boolean(['h','v','V'])
			.alias('h','help')   .describe('h', 'lists usage arguments')
			.alias('v','version').describe('v', 'print nodeclipse CLI version')			
			.alias('V','verbose').describe('V', 'be verbose')
			.argv;

var helpstr =
github IjzerenHein / famous-flex-demo / webpack.config.js View on Github external
/*global module, process*/
/*eslint no-use-before-define:0 */

var webpack = require('webpack');
var webpackDevServer = require('webpack-dev-server');
var path = require('path');

// Support for extra commandline arguments
var argv = require('optimist')
            //--env=XXX: sets a global ENV variable (i.e. window.ENV='XXX')
            .alias('e','env').default('e','dev')
            //--minify:  minifies output
            .alias('m','minify')
            .argv;

var config = {
  context: path.join(__dirname, 'src'),
  entry: {'bundle': './main'},
  output: {
    path: path.join(__dirname, 'dist'),
    filename: '[name].js',
    publicPath: isDevServer() ? '/' : ''
  },
  devServer: {
    publicPath: '/'
github mafintosh / node-modules-cli / app.js View on Github external
#!/usr/bin/env node

var search = require('./index');
var stream = require('stream-wrapper');
var path = require('path');
var fs = require('fs');
var colors = require('colors');
var tty = require('tty');
var request = require('request');
var proc = require('child_process');
var osenv = require('osenv');
var argv = require('optimist').alias('u', 'username').alias('r','reset').argv;

var home = osenv.home();
var username = '';

try {
	username = fs.readFileSync(path.join(home,'.node-modules'), 'utf-8');
} catch (err) {
	// do nothing
}

var color = function(str, name) {
	return colors[name](str);
};

var setRawMode = function(mode) {
	process.stdin.setRawMode ? process.stdin.setRawMode(mode) : tty.setRawMode(mode);
github joeferner / node-gitgui / bin / app.js View on Github external
#!/usr/bin/env node
'use strict';

var openport = require('openport');
var appjs = require('appjs');
var path = require('path');

var optimist = require('optimist');

var args = optimist
  .alias('h', 'help')
  .alias('h', '?')
  .options('repo', {
    string: true,
    describe: 'The path to the root of the repo.'
  })
  .argv;

if (args.help) {
  optimist.showHelp();
  return process.exit(-1);
}

var repo = path.resolve(args.repo || args._[0] || '.');
console.log("Using repo", repo);
github soheilpro / catj / catj.js View on Github external
#!/usr/bin/env node

var fs = require('fs');
var colors = require('colors');
var eol = require('os').EOL;
var optimist = require('optimist')
    .alias('h', 'help')
    .describe('h', 'Displays help.')
    .usage('Usage:' + eol +
           '  catj [-h|--help] [file]...');

if (optimist.argv.help) {
  console.log(optimist.help());
  return;
}

if (optimist.argv._.length === 0 || optimist.argv._[0] === '-') {
  var input = '';

  process.stdin.on('data', function(chunk) {
    input += chunk;
  });
github soheilpro / mann / mann.js View on Github external
#!/usr/bin/env node

var fs = require('fs');
var spawn = require('child_process').spawn;
var colors = require('colors');
var eol = require('os').EOL;
var optimist = require('optimist')
    .alias('e', 'edit')
    .alias('a', 'add')
    .alias('d', 'delete')
    .alias('l', 'list')
    .describe('e', 'Edit command\'s mann page.')
    .describe('a', 'Add line to command\'s mann page.')
    .describe('d', 'Delete command\'s mann page.')
    .describe('l', 'List all available mann pages.')
    .usage('Usage:' + eol +
      '  mann ' + eol +
      '  mann -e ' + eol +
      '  mann -a  
github joeferner / node-gitgui / bin / web.js View on Github external
#!/usr/bin/env node

'use strict';

var optimist = require('optimist');

var args = optimist
  .alias('h', 'help')
  .alias('h', '?')
  .options('port', {
    alias: 'p',
    string: true,
    describe: 'The port to run the server on.',
    default: 9000
  })
  .options('repo', {
    string: true,
    describe: 'The path to the root of the repo.'
  })
  .argv;

if (args.help) {
  optimist.showHelp();
github pwlmaciejewski / markdown-html / index.js View on Github external
#!/usr/bin/env node

var path = require('path');
var templateDir = __dirname + '/template';
var optimist =  require('optimist')
    .alias({
        't': 'title',
        'l': 'template',
        's': 'style',
        'j': 'script',
        'h': 'help',
        'o': 'output-file',
        'i': 'stdin',
        'w': 'watch',
        'v': 'version'
    })
    .describe({
        'title': 'Generated page title',
        'style': 'Path to custom stylesheet',
        'script': 'Path to custom javascript',
        'template': 'Path to custom mustache template',
github YMFE / ykit / src / cli.js View on Github external
let initOptions = (cmd) => {
    if (cmd.setOptions) {
        cmd.setOptions(optimist);
    } else if (cmd.set_options) {
        cmd.set_options(optimist);
    }
    optimist.alias('h', 'help');
    optimist.describe('h', '查看帮助');
    let options = optimist.argv;
    options.cwd = process.cwd();
    return options;
};