How to use the yargs.version 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 Azure / azure-sdk-for-js / sdk / eventhub / testhub / cli.ts View on Github external
#!/usr/bin/env node

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/* tslint:disable */

import * as yargs from "yargs";
const CtrlC = require("death");
import { cache } from "./commands/sendReceive";
import { partitionCount, uberStartTime, startTime } from "./commands/receive";
import { getCurrentCommand } from "./utils/util";

yargs
  .version("0.1.0")
  .commandDir("./commands")
  .strict()
  .option("h", { alias: "help" })
  .option("c", {
    alias: "conn-str",
    describe: "EventHub connection string.",
    string: true
  })
  .option("n", {
    alias: "hub",
    describe: "Name of the EventHub.",
    demandOption: true,
    string: true
  })
  .option("a", {
github NMMES / nmmes-cli / src / options.js View on Github external
} else {
            Logger.warn(`[Profile: ${initialArgs.profile}]`, "The use of this profile has been depricated, please use another profile.");
        }
    }

    if (profile.messages)
        for (const message of profile.messages) {
            Logger[message.level](`[Profile: ${initialArgs.profile}]`, message.text);
        }

    if (profile.options && profile.options.modules) {
        cliSpecificOptions.modules.default = profile.options.modules;
        cliSpecificOptions.modules.defaultSetBy = 'profile';
    }

    let moduleArgs = yargs
        .version(false)
        .help(false)
        .options({
            modules: cliSpecificOptions.modules,
            'install-modules': cliSpecificOptions['install-modules'] // Install modules
        }).argv;

    let modules = await loadModules(moduleArgs.modules, moduleArgs.i);
    let options = Object.assign({}, cliSpecificOptions, await extractModuleOptions(modules));

    for (let [key, value] of Object.entries(profile.options || {})) {
        if (!options[key]) {
            Logger.warn(`Option ${key} is not associated with an activated module.`);
            continue;
        }
        options[key].default = value;
github typicode / stop-server / bin.js View on Github external
}

  console.log(
    [
      '',
      'To access stop-server from your phone, scan the QR code here',
      chalk.cyan('http://localhost:5709/qr.html'),
      '',
      'Or go directly to',
      chalk.cyan('http://' + address() + ':5709'),
      ''
    ].join('\n')
  )
}

var yargs = require('yargs')
  .version(pkg.version)
  .alias('v', 'version')
  .usage('Usage: $0 start|stop')
  .demand(1)

var argv = yargs.argv

if (argv._[0] === 'start') return start()
if (argv._[0] === 'stop') return stop()

console.log(yargs.showHelp)
github showdownjs / showdown / src / cli / cli.js View on Github external
/**
 * Created by tivie
 */
'use strict';

var yargs = require('yargs');

yargs
  .version()
  .alias('v', 'version')
  .option('h', {
    alias: 'help',
    description: 'Show help'
  })
  .option('q', {
    alias: 'quiet',
    description: 'Quiet mode. Only print errors',
    type: 'boolean',
    default: false
  })
  .option('m', {
    alias: 'mute',
    description: 'Mute mode. Does not print anything',
    type: 'boolean',
github contentful / contentful-import / lib / usageParams.js View on Github external
import yargs from 'yargs'
import * as packageFile from '../package'

export default yargs
  .version(packageFile.version || 'Version only available on installed package')
  .usage('Usage: $0 [options]')
  .option('space-id', {
    describe: 'ID of the destination space',
    type: 'string',
    demand: true
  })
  .option('environment-id', {
    describe: 'ID the environment in the destination space',
    type: 'string',
    default: 'master',
    demand: false
  })
  .option('management-token', {
    describe: 'Contentful management API token for the destination space',
    type: 'string',
github stricter / stricter / src / cli / index.ts View on Github external
export default (): number => {
    const argv = yargs
        .version(process.env.STRICTER_VERSION as string)
        .option('config', {
            alias: 'c',
            description: 'Specify config location',
            string: true,
            requiresArg: true,
        })
        .option('reporter', {
            alias: 'r',
            description: 'Specify reporter',
            choices: ['console', 'mocha', 'junit'],
            requiresArg: true,
        })
        .option('rule', {
            description: 'Verify particular rule',
            array: true,
github smartive / kuby / src / kubernetes-helpers.ts View on Github external
terminalWidth,
  version,
  wrap,
} from 'yargs';

import { commands } from './commands';
import { envTrimPrefix } from './utils/env-trim-prefix';
import { KubernetesApi } from './utils/kubernetes-api';
import { Logger, LogLevel } from './utils/logger';

yargonaut.style('blue').errorsStyle('red.bold');

const findUp = require('find-up');

scriptName('kuby');
version(false);

strict();

middleware((args: Arguments) => {
  args.logLevel = (LogLevel[args['logLevel']] as unknown) as LogLevel;
  Logger.level = args['logLevel'];
});

middleware((args: Arguments) => {
  if (args.trimEnvPrefix) {
    envTrimPrefix(args.trimEnvPrefix);
  }
});

middleware((args: Arguments) => {
  if (args.namespace) {
github darcyclarke / rawkit / bin / cli.js View on Github external
parseArguments (args) {
    return yargs
      .version()
      .demandCommand(1)
      .usage('rawkit [options] ')
      .alias('v', 'version')
      .version(version)
      .describe('v', 'show version information')
      .alias('h', 'help')
      .help('help')
      .usage('Usage: $0 -x [num]')
      .showHelpOnFail(false, 'Specify --help for available options')
      .option('executable', {
        describe: 'Specify the name of the executable.',
        default: 'google chrome'
      })
      .option('canary', {
        describe: 'Run the devtools in canary.',
github electron-userland / electron-installer-redhat / src / cli.js View on Github external
#!/usr/bin/env node

const _ = require('lodash')
const yargs = require('yargs')

const installer = require('./installer')
const pkg = require('../package.json')

const argv = yargs
  .version(pkg.version)
  .usage(pkg.description + '\n\nUsage: $0 --src  --dest  --arch ')
  .option('src', {
    describe: 'Directory that contains your built Electron app (e.g. with `electron-packager`)',
    demand: true
  })
  .option('dest', {
    describe: 'Directory that will contain the resulting Red Hat installer',
    demand: true
  })
  .option('arch', {
    describe: 'Machine architecture the package is targeted to',
    demand: true
  })
  .option('config', {
    describe: 'JSON file that contains the metadata for your application',