How to use the yargs.alias function in yargs

To help you get started, we’ve selected a few yargs 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 emarock / proxy-pac-proxy / command.js View on Github external
}
  })

  yargs.command(require('./command-start'))
  yargs.command(require('./command-stop'))
  yargs.command(require('./command-env'))

  yargs.command('*', false, () => {
    yargs.showHelp();
    console.error("Non-existing or no command specified.");
    process.exit(1);
  })
  yargs.demandCommand(1)

  yargs.help('h')
  yargs.alias('h', 'help')
  yargs.alias('v', 'version')
  yargs.env(meta.name.replace(/-/g, '').toUpperCase())

  const argv = yargs.argv

}
github danhper / bigcode-tools / ast-generators / javascript / bin / bigcode-ast.js View on Github external
#!/usr/bin/env node

const astGenerator = require('..');
const yargs = require('yargs');

const argv = yargs
    .alias('f', 'files')
    .alias('o', 'output-dir')
    .demandOption(['files', 'output-dir'])
    .usage('Usage: $0 -f  -o ')
    .example('$0 -f src/**/*.js -o result',
             'parse all JS files in src dir and output ASTs in result dir')
    .describe('files', 'Glob pattern of files to parse')
    .describe('output-dir', 'The directory where to put the results')
    .help('h')
    .alias('h', 'help')
    .argv;

astGenerator(argv, (err, count) => {
  if (err !== null) {
    console.error('failed: ' + err);
  } else {
github react-bootstrap / react-router-bootstrap / webpack.config.babel.js View on Github external
import webpack from 'webpack';
import yargs from 'yargs';

const { optimizeMinimize } = yargs.alias('p', 'optimize-minimize').argv;
const nodeEnv = optimizeMinimize ? 'production' : 'development';

export default {
  entry: {
    'ReactRouterBootstrap': './src/index.js'
  },
  output: {
    path: './lib',
    filename: optimizeMinimize ? '[name].min.js' : '[name].js',
    library: 'ReactRouterBootstrap',
    libraryTarget: 'umd'
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }
    ]
github burakhanalkan / react-dynamic-style-loader / webpack.config.js View on Github external
var webpack =require('webpack');
var yargs = require('yargs');

const options = yargs
  .alias('p', 'optimize-minimize')
  .alias('d', 'debug')
  .argv;

const jsLoader = 'babel?cacheDirectory';

module.exports = {
    entry: {
      'react-dynamic-style-loader': './src/index.js'
    },
    output: {
       path: '.',
       filename: options.optimizeMinimize ? 'index.min.js' : 'index.js',
       library: 'ReactDynamicStyleLoader',
       libraryTarget: 'umd'
    },
github uber / xviz / modules / ros / src / main.js View on Github external
require('babel-polyfill');

import {BagDump, Convert} from './cmds';

const StartEndOptions = {
  start: {
    alias: 's',
    describe: 'Starting timestamp to begin conversion'
  },
  end: {
    alias: 'e',
    describe: 'Ending timestamp to stop conversion'
  }
};

const yargs = require('yargs')
  .alias('h', 'help')
  .command(
    'convert [-d output] ',
    'Convert a rosbag to xviz',
    {
      ...StartEndOptions,
      dir: {
        alias: 'd',
        describe: 'Directory to save XVIZ data',
        demandOption: true
      }
    },
    Convert
  )
  .command(
    'bagdump ',
github kennyki / vue-webpack-gettext / compile.js View on Github external
const shell = require('shelljs')
const path = require('path')
const fs = require('fs')
const glob = require('glob')
const po2json = require('easygettext/src/compile').po2json

const argv = require('yargs')
  .alias('output', 'o')
  .describe('output', 'The output folder for translation JSON file(s)')

  .alias('filename', 'f')
  .describe('filename', 'The file name for translation JSON file(s)')
  .default('filename', 'translation.json')

  .alias('src', 's')
  .describe('src', 'The source folder for PO files')

  .alias('multiple', 'm')
  .describe('multiple', 'Should it generate a single JSON file containing all translations, or multiple JSON files each for a translation')
  .default('multiple', false)

  .demand(['src', 'output'])
  .argv
github developmentseed / vt-grid / copy-base.js View on Github external
#!/usr/bin/env node

var path = require('path')
var MBTiles = require('mbtiles')
var list = require('./lib/list')

var argv = require('yargs')
  .alias('output', 'o')
  .alias('zoom', 'z')
  .demand(['o', 'z'])
  .demand(1)
  .argv

var input = argv._[0]
var output = argv.output
var zoom = argv.zoom

input = path.resolve(process.cwd(), input)
output = path.resolve(process.cwd(), output)

var mbtiles = new MBTiles('mbtiles://' + input, function (err) {
  if (err) { throw err }
  list(mbtiles, zoom, function (err, tiles) {
github filipelinhares / fast-editorconfig / cli.js View on Github external
#!/usr/bin/env node

'use strict';

const fs        = require('fs');
const chalk     = require('chalk');
const multiline = require('multiline');
const pkg       = require('./package.json');
const pathExists = require('path-exists');
const argv      = require('yargs')
  .alias('t', 'type')
  .alias('s', 'style')
  .alias('l', 'size')
  .alias('r', 'root')
  .alias('w', 'whitespace')
  .alias('m', 'maxline')
  .alias('n', 'newline')
  .alias('h', 'help')
  .alias('v', 'version')
  .argv;

let str    = [];
let header = ['# editorconfig.org'];

let options = {
      fileType   : argv.type,
github hubot-js / hubot.js / src / cli / cli.js View on Github external
function createParameters() {
  yargs.alias('t', 'token')
    .alias('n', 'name')
    .global('token')
    .global('name');
}