本文整理汇总了TypeScript中yargs.help函数的典型用法代码示例。如果您正苦于以下问题:TypeScript help函数的具体用法?TypeScript help怎么用?TypeScript help使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了help函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
function Argv$helpDescriptionExplicit() {
let ya = yargs
.help('help', 'description', true)
.argv;
}
示例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'
})
示例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;
示例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"
})
示例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;
示例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 {
//.........这里部分代码省略.........
示例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'
})