当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript yargs.help函数代码示例

本文整理汇总了TypeScript中yargs.help函数的典型用法代码示例。如果您正苦于以下问题:TypeScript help函数的具体用法?TypeScript help怎么用?TypeScript help使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了help函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

function Argv$helpDescriptionExplicit() {
    let ya = yargs
        .help('help', 'description', true)
        .argv;
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:5,代码来源:yargs-tests.ts

示例2: require

const performanceXServer = require('./performance-experiment/server');
import * as Printer from './printer';
import * as randomPort from './random-port';
import {Results} from './types/types';
const yargs = require('yargs');
const opn = require('opn');
const updateNotifier = require('update-notifier');
const pkg = require('../package.json');

updateNotifier({pkg}).notify(); // Tell user if there's a newer version of LH.

interface LighthouseError extends Error {
  code?: string
};

const cliFlags = yargs
  .help('help')
  .version(() => pkg.version)
  .showHelpOnFail(false, 'Specify --help for available options')

  .usage('$0 url')

  // List of options
  .group([
    'verbose',
    'quiet'
  ], 'Logging:')
  .describe({
    verbose: 'Displays verbose logging',
    quiet: 'Displays no progress, debug logs or errors'
  })
开发者ID:CondeNast,项目名称:lighthouse,代码行数:31,代码来源:bin.ts

示例3:

import * as yargs from 'yargs';
import * as Contracts from './contracts';

export default yargs
    .help('help', 'Show help.')
    .version(() => {
        return `Current version: ${require('../package.json').version}.`;
    })
    .option('config', {
        alias: 'c',
        describe: 'Path to config file.',
        type: 'string'
    })
    .option('backup', {
        alias: 'b',
        describe: 'Make backup before cleanup.',
        default: undefined,
        type: 'boolean'
    })
    .argv as Contracts.Arguments;
开发者ID:QuatroCode,项目名称:cleanup-package-json,代码行数:20,代码来源:arguments.ts

示例4:

import * as yargs from 'yargs';

export interface ArgOptions {
    append?: string;
    out?: string;
    configJson?: string;
    baseDir?: string;
}

export default yargs
    .help("help", "Show help")
    .version(() => {
        return `Current version: ${require('../package.json').version}`;
    })
    .option('append', {
        describe: 'Append files to global',
        type: "string"
    })
    .option("out", {
        describe: "dts-bundle bundled out file",
        type: "string"
    })
    .option("configJson", {
        describe: "dts-bundle configuration file",
        default: "dts-bundle.json",
        type: "string"
    })
    .option("baseDir", {
        describe: "dts-bundle base directory",
        type: "string"
    })
开发者ID:QuatroCode,项目名称:dts-bundle-append,代码行数:31,代码来源:arguments.ts

示例5:

import {GsdApp} from './app/gsd';
import {QueryApp} from './app/query';
import * as Fs from 'fs';
import * as yargs from 'yargs';

[GsdApp, QueryApp].forEach(x => x.setupArgv(yargs));

yargs
  .help()
  .version(require('../package.json').version)
  .demand(1, 'must provide a valid command')
  .argv;
开发者ID:SIXNetworks,项目名称:withSIX-GSD,代码行数:12,代码来源:runner.ts

示例6: function

(function() {
	let command = argv._[0];
	if (command === 'enrichment') {
		if (argv.input) {
			fs.readFile(argv.input, 'utf8', function (err, raw_data) {
				if (err) {
					process.stderr.write(`Could not open file: ${argv.input}\n`);
					return;
				}
				let data = raw_data.split('\n');
				data = data.map((d) => { return d.replace('\r', ''); }); 
				console.log('=> Running cluster enrichment analysis...');
				clusterEnrichment.run(data, argv.type, (result) => {
					if (argv.output) {
						fs.writeFile(argv.output, JSON.stringify(result, null, 2), (err) => {
							if (err) {
								process.stdout.write(`\x1b[31m=> Could not write to file ${argv.output}. \x1b[0m \n`);
							}
							else {
								console.log('=> Output written to file.');
							}
						});
					}
					if (argv.sort) {
						console.log(`=> Sorting by: ${argv.sort}`);
						try {
							let sort_key = argv.sort.split('.'),
								stage = _.indexOf(clusterEnrichment.clusterToStage, sort_key[0]);
							if (stage === -1) {
								throw new Error(`Not a valid cluster: ${sort_key}`);
							}
							sort_key[0] = 'data[' + stage + ']';
							result = utils.sort(result, sort_key.join('.'));
							utils.tabulate(result, ['label', sort_key.join('.')], console.log);
						}
						catch (e) {
							process.stdout.write(`\x1b[31m=> Sort failed: ${e.message}. \x1b[0m \n`);
						}
					}
					
					console.log('=> Done.');
				});			
			});
		}
		else if (argv.disease || argv.kegg) {
			console.log('=> Running cluster enrichment analysis...');
			let input = [argv.disease || argv.kegg],
				type = (argv.disease ? 'disease' : 'kegg');
			clusterEnrichment.run(input, type, (result) => {
				if (result.length == 0) {
					console.log('=> Done.');
					return;
				}
				if (argv.output) {
					fs.writeFile(argv.output, JSON.stringify(result, null, 2), (err) => {
						if (err) {
							process.stdout.write(`\x1b[31m=> Could not write to file ${argv.output}. \x1b[0m \n`);
						}
						else {
							console.log('=> Output written to file.');
							console.log('=> Done.');
						}
					});
				}
				else {
					utils.tabulate(result, clusterEnrichment.clusterToStage.map(function(stage) { return 'data[' }), console.log);
					console.log('=> Done.');
				}				
			});
		}
		else {
			console.log(yargs.help());
		}
	}
  else if (command === 'filter') {
    if (argv.input === undefined) {
      process.stderr.write(`Input file required.`);
      return;
    }
    if (argv.output === undefined) {
      process.stderr.write(`Output file required.`);
      return;
    }
    fs.readFile(argv.input, 'utf8', function (err, raw_data) {
      if (err) {
        process.stderr.write(`Could not open file: ${argv.input}\n`);
        return;
      }
      console.log('=> Running filter...');
      let input_list = raw_data.split('\n');
      input_list = input_list.map((d) => { return d.replace('\r', ''); });
      Filter.valid(input_list, (result) => {
        result = result.filter((d) => { return d; });
        console.log(`Filtered ${input_list.length-result.length}/${input_list.length} input genes`);
        let res_string = result.join('\n');
        fs.writeFile(argv.output, res_string, (err) => {
          if (err) {
            process.stdout.write(`\x1b[31m=> Could not write to file ${argv.output}. \x1b[0m \n`);
          }
          else {
//.........这里部分代码省略.........
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:101,代码来源:main.ts

示例7: require

  console.warn('Compatibility error', 'Lighthouse requires node 5+ or 4 with --harmony');
  process.exit(_RUNTIME_ERROR_CODE);
}

import * as path from 'path';
const yargs = require('yargs');
import * as Printer from './printer';
const lighthouse = require('../lighthouse-core');
const assetSaver = require('../lighthouse-core/lib/asset-saver.js');
const log = require('../lighthouse-core/lib/log');
import {ChromeLauncher} from './chrome-launcher';
import * as Commands from './commands/commands';

const perfOnlyConfig = require('../lighthouse-core/config/perf.json');

const cli = yargs
  .help('help')
  .version(() => require('../package').version)
  .showHelpOnFail(false, 'Specify --help for available options')

  .usage('$0 url')

  // List of options
  .group([
    'verbose',
    'quiet'
  ], 'Logging:')
  .describe({
    verbose: 'Displays verbose logging',
    quiet: 'Displays no progress or debug logs'
  })
开发者ID:vigneshshanmugam,项目名称:lighthouse,代码行数:31,代码来源:bin.ts


注:本文中的yargs.help函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。