本文整理汇总了TypeScript中commander.option函数的典型用法代码示例。如果您正苦于以下问题:TypeScript option函数的具体用法?TypeScript option怎么用?TypeScript option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了option函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
options.forEach(element => {
program.option(`--${element.key} <${element.key}>`, element.text);
});
开发者ID:bespoken,项目名称:bst,代码行数:3,代码来源:bst-test.ts
示例2: debug
import * as fs from "fs"
import * as repl from "repl"
import * as jsome from "jsome"
import { FakeCI } from "../ci_source/providers/Fake"
import { GitHub } from "../platforms/GitHub"
import { GitHubAPI } from "../platforms/github/GitHubAPI"
import { Executor } from "../runner/Executor"
import { pullRequestParser } from "../platforms/github/pullRequestParser"
import { runDangerfileEnvironment } from "../runner/DangerfileRunner"
import { DangerContext } from "../runner/Dangerfile"
import { dangerfilePath } from "./utils/file-utils"
const d = debug("danger:pr")
program
.option("-v, --verbose", "Output more text to the stdout than a normal run")
.option("-d, --dangerfile [filePath]", "Specify custom dangerfile other than default dangerfile.js")
.option("-r, --repl", "Drop into a Node REPL after evaluating the dangerfile")
.parse(process.argv)
const dangerFile = dangerfilePath(program)
if (program.args.length === 0) {
console.error("Please include a PR URL to run against")
process.exitCode = 1
} else {
const pr = pullRequestParser(program.args[0])
if (!pr) {
console.error("Could not get a repo and a PR number from your URL, bad copy & paste?")
process.exitCode = 1
开发者ID:tychota,项目名称:danger-js,代码行数:32,代码来源:danger-pr.ts
示例3: log
import * as program from 'commander'
import { createReadStream } from 'fs'
import { join } from 'path'
import { createInterface } from 'readline'
import * as winston from 'winston'
import { labelFormatter } from '../server/helpers/logger'
import { CONFIG } from '../server/initializers/constants'
program
.option('-l, --level [level]', 'Level log (debug/info/warn/error)')
.parse(process.argv)
const excludedKeys = {
level: true,
message: true,
splat: true,
timestamp: true,
label: true
}
function keysExcluder (key, value) {
return excludedKeys[key] === true ? undefined : value
}
const loggerFormat = winston.format.printf((info) => {
let additionalInfos = JSON.stringify(info, keysExcluder, 2)
if (additionalInfos === '{}') additionalInfos = ''
else additionalInfos = ' ' + additionalInfos
return `[${info.label}] ${toTimeFormat(info.timestamp)} ${info.level}: ${info.message}${additionalInfos}`
})
开发者ID:jiang263,项目名称:PeerTube,代码行数:30,代码来源:parse-log.ts
示例4: require
import {SummaryMapConsoleFormatter} from "../src/SummaryMapConsoleFormatter";
import {SummaryMapSlackFormatter} from "../src/SummaryMapSlackFormatter";
import {Deployment} from '../src/Deployment';
import debug from '../src/Debug';
require('colors');
var prog = require('commander');
const version = '2.0.4';
const cwd = process.cwd();
prog.version(version);
prog.usage('[options] <subcommand> ...');
prog.option('-v, --verbose', 'verbose mode');
prog.option('-c, --config <file>', 'config file');
prog.command('browse [site]')
.description('open site in a browser')
.action((site : string, options) => {
const config = readConfig(prog.config);
const siteConfig = config.sites[site];
if (!siteConfig) {
console.error(`${site} config not found.`);
return;
}
const child_process = require('child_process');
开发者ID:c9s,项目名称:typeloy,代码行数:31,代码来源:typeloy.ts
示例5: findMain
#!/usr/bin/env node
import * as program from "commander";
import * as fs from "fs";
import * as path from "path";
import findMain from "./findMain";
import generateJSON from "./generate-json";
program
.option("-s","--save","Save to file")
.parse(process.argv);
let { main, packageJson } = findMain();
console.log(generateJSON(main,packageJson,true));
开发者ID:Floodway,项目名称:flood-processor,代码行数:13,代码来源:main-generate-json.ts
示例6: require
* --out ./draft_notes.md
*/
import * as commander from 'commander';
import * as shell from 'shelljs';
import * as mkdirp from 'mkdirp';
// tslint:disable-next-line:no-require-imports
const octokit = require('@octokit/rest')();
import * as readline from 'readline';
import * as fs from 'fs';
import * as util from './util';
import {$, Repo, RepoCommits, Commit} from './util';
const TMP_DIR = '/tmp/tfjs-release-notes';
commander.option('--startVersion <string>', 'Which version of union to use')
.option('--endVersion <string>', 'Which version of union to use')
.option('--out <string>', 'Where to write the draft markdown')
.parse(process.argv);
if (commander.startVersion == null) {
console.log('Please provide a start version with --startVersion.');
process.exit(1);
}
if (commander.out == null) {
console.log('Please provide a file to write the draft to with --out');
process.exit(1);
}
const UNION_DEPENDENCIES: Repo[] = [
开发者ID:Guolighting,项目名称:tfjs,代码行数:31,代码来源:release_notes.ts
示例7: require
import {Progress} from './Progress';
import * as FlashMagic from './index';
var dump = require('buffer-hexdump');
import * as program from 'commander';
import * as path from 'path';
import * as fs from 'fs';
const DEFAUL_COM_PORT = '/dev/tty.usbmodemFD131';
const DEFAUL_BAUD_RATE = 115200;
const DEFAUL_CRYSTAL_CLOCK = 12000000;
program
.option('-P, --port [port]', `serial port [${DEFAUL_COM_PORT}]`, DEFAUL_COM_PORT)
.option('-B, --baudrate [baudrate]', `baudrate [${DEFAUL_BAUD_RATE}]`, DEFAUL_BAUD_RATE)
.option('-V, --verbose', `make the operation more talkative`, true)
.option('--cclk [cclk]', `crystal clock in Hz [${(DEFAUL_CRYSTAL_CLOCK / 1000000).toFixed(3)} MHz]`, DEFAUL_CRYSTAL_CLOCK);
program.command('write')
.description('program file')
.option('-A, --address <address>', 'ROM address', parseInt)
.option('-I, --input <file>', 'input file', null)
.action((cmd) => {
open()
.then(isp => programFile(isp, cmd.input, cmd.address))
.then(() => process.exit(0))
.catch(catchError);
});
program.command('ping')
.description('ping device')
开发者ID:sergezloto,项目名称:flashmagic.js,代码行数:31,代码来源:cli.ts
示例8: require
/// <FILTERS REFERENCES>
/// <reference path="./application/filters/AuthFilter.ts" />
/// <MODELS REFERENCES>
/// <reference path="./application/models/UserModel.ts" />
/// <reference path="./application/models/PostModel.ts" />
/// <CONTROLLERS REFERENCES>
/// <reference path="./application/controllers/HomeController.ts" />
module Sparky {
var program:any = require('commander');
program.version('0.0.1');
program.option('-p, --port <port>', 'specify the port [3000]', 3000);
program.option('-e, --env <engine>', 'specify environment (development|test|production) [development]', 'development');
program.parse(process.argv);
var rootPath:string = __dirname + '/../example/example';
var env:string = process.env.NODE_ENV || program.env;
var port:number = process.env.PORT || program.port;
export var app:OX.Application = new OX.Application(rootPath, env, port);
app.setAppConfig(new AppConfig());
app.setLoggerConfig(new LoggerConfig());
app.setDatabaseConfig(new DatabaseConfig());
app.setExpressConfig(new ExpressConfig());
app.setRoutesConfig(new RoutesConfig());
开发者ID:mahmed8003,项目名称:an-ox,代码行数:30,代码来源:app.ts
示例9: require
const pkg = require('../package.json');
commander.version(pkg.version);
commander.usage('<command> [options]');
// global options
const allowedLogLevels = Object.keys(levels).map(level =>
level.toLocaleLowerCase()
);
commander.option(
'-l, --log-level <level>',
'set log level',
(value: any) => {
if (allowedLogLevels.some(allowedValue => value === allowedValue)) {
return value;
} else {
throw `Your log level ${yellow(
value
)} doesn't match any of the valid values: ${yellow(
allowedLogLevels.join(', ')
)}.`;
}
},
'info'
);
commander.option('-u, --ignore-updates', 'ignore updates');
function handleAction(
importAction: () => Promise<{ default: (options?: any) => Promise<any> }>
) {
return async (options: any) => {
// handle global options
setLevel(levels[options.parent.logLevel.toUpperCase()]);
开发者ID:otbe,项目名称:ws,代码行数:32,代码来源:index.ts
示例10: require
/// <reference path="typings/tsd.d.ts" />
export = module;
var program = require('commander');
program
.option("-n, --noprompt", "Automatically clone all repositories without prompting")
.option("-l, --links", "Create npm & tsd symbolic links after installation")
.option("-i, --npmi", "Execute npm install on all repositories")
.option("-a, --all", "Run with all options [-n,-l,-i,-d]")
.option("-d, --default", "Checkout default branch if the repository is already cloned")
.option("-e, --exclude <project;...>", "Project name to exclude, semicolon seperated")
.parse(process.argv);
program.exclude = ["installation"].concat(program.exclude && program.exclude.split(";") || []);
program.noprompt = program.all || program.noprompt;
program.links = program.all || program.links;
program.npmi = program.all || program.npmi;
program.default = program.all || program.default;
import async = require("async");
import _ = require("lodash");
import github = require("./lib/github");
import fs = require("fs");
import path = require("path");
import git = require("./lib/git");
var tsd = require("tsd");
var prompt = require("prompt");
import links = require("./lib/links");
import utils = require("./lib/utils");
import npmi = require("./lib/npmi");
var execEndMessage = utils.execEndMessage;
var execResult = utils.execResult;
开发者ID:my-koop,项目名称:installation,代码行数:31,代码来源:index-install.ts
注:本文中的commander.option函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论