• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript command-line-args.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: express



const app: Application = express();

app.use(cookieParser());
app.use(retrieveUserIdFromRequest);
app.use(bodyParser.json());


const commandLineArgs = require('command-line-args');

const optionDefinitions = [
    { name: 'secure', type: Boolean,  defaultOption: true },
];

const options = commandLineArgs(optionDefinitions);

// REST API
app.route('/api/lessons')
    .get(checkIfAuthenticated,
        _.partial(checkIfAuthorized,['STUDENT']),
        readAllLessons);

app.route('/api/admin')
    .post(checkIfAuthenticated,
        _.partial(checkIfAuthorized,['ADMIN']),
        loginAsUser);

app.route('/api/signup')
    .post(createUser);
开发者ID:bala1074,项目名称:angular-security-course,代码行数:28,代码来源:server.ts


示例2: commandLineArgs

import {OntoUmlModel} from "./src/OntoUml";
import OntoUmlToOntoObjectModelMapper from "./src/OntoUmlToOntoObjectModelMapper";
import CSharpMapper from "./src/Output/CSharp/CSharpMapper";
import CSharpModelRenderer from "./src/Output/CSharp/CSharpModelRenderer";
import JsonMapper from "./src/Output/Json/JsonMapper";
import JsonRenderer from "./src/Output/Json/JsonRenderer";
import {IOptions, IFrontEnd, ILanguageMapper, ILanguageRenderer} from "./src/Interfaces";
import {OntoObjectModel} from "./src/OntoObjectModel";
import TypeMappingHelper from "./src/TypeMappingHelper";

var cli = commandLineArgs([
    { name: "help", alias: "h", type: Boolean, description: "Displays this help message and quits." },
    { name: "verbose", alias: "v", type: Boolean, description: "Displays additional output." },
    { name: "input", alias: "i", defaultOption: true, type: String, description: "The input file to process." },
    { name: "inputForm", alias: "I", type: String, description: "The input form code. Valid values:\n\"refontouml\":\t RefOntoUml from OLED.\n\"onto-object-model\":\t JSON of the OntoObjectModel.\n Defaults to \"refontouml\"." },
    { name: "output", alias: "o", type: String, description: "The output directory or file (if singleFile flag is set)." },
    { name: "outputForm", alias: "O", type: String, description: "The output form code. Valid values:\n\"csharp-model\":\t model classes with semantic checks in C#\nConfig options:\n-c namespace=<namespaceName> name of the namespace to use\n\n\"onto-object-model\":\t JSON of the OntoObjectModel\n\n Defaults to \"csharp-model\"." },
    { name: "singleFile", alias: "s", type: Boolean, description: "If set, all the generated code will be placed in a single file." },
    { name: "typeMapping", alias: "t", type: String, description: "Path to file containing primitive type mapping definitions." },
    { name: "config", alias: "c", type: String, multiple: true, description: "Additional configuration options in the form <name>=<value>." }
]);
var usageData = {
    title: "OntoUML code generator",
    description: "Generates source code from OntoUML models.",
    footer: "Project home: [underline]{https://github.com/CCMi-FIT/ontouml-code-generator}"
};

function processConfigOptions(rawOptions: IOptions & { config: string[] }): IOptions {
    let result: IOptions = _.cloneDeep(_.omit(rawOptions, "config") as IOptions);
    result.configuration = {};
    _.forEach(rawOptions.config, (pair: string) => {
开发者ID:CCMi-FIT,项目名称:ontouml-code-generator,代码行数:31,代码来源:app.ts


示例3: commandLineArgs

	constructor() {
		this.commandLineParser = commandLineArgs([
			{ name: 'verbose', alias: "v", type: Boolean },
			{ name: 'master', alias: "m", type: String },
			{ name: 'section', alias: "s", type: String }
		]);
	}
开发者ID:duffman,项目名称:packman,代码行数:7,代码来源:commandline.processor.ts


示例4: parseOptions

// Parse the options in argv and split them into global options and renderer options,
// according to each option definition's `renderer` field.  If `partial` is false this
// will throw if it encounters an unknown option.
function parseOptions(definitions: OptionDefinition[], argv: string[], partial: boolean): Partial<CLIOptions> {
    let opts: { [key: string]: any };
    try {
        opts = commandLineArgs(definitions, { argv, partial });
    } catch (e) {
        assert(!partial, "Partial option parsing should not have failed");
        return messageError("DriverCLIOptionParsingFailed", { message: e.message });
    }

    const options: { rendererOptions: RendererOptions; [key: string]: any } = { rendererOptions: {} };
    for (const o of definitions) {
        if (!hasOwnProperty(opts, o.name)) continue;
        const v = opts[o.name] as string;
        if (o.renderer !== undefined) options.rendererOptions[o.name] = v;
        else {
            const k = _.lowerFirst(
                o.name
                    .split("-")
                    .map(_.upperFirst)
                    .join("")
            );
            options[k] = v;
        }
    }
    return options;
}
开发者ID:nrkn,项目名称:quicktype,代码行数:29,代码来源:index.ts


示例5: require

import 'babel-polyfill';
import {createConversation, ALL_CONVERSATIONS}  from './conversations';
import * as Sequelize from 'sequelize';
import {defineModels} from './models';
import {Reminder} from './conversations/reminder';
const commandlineArgs = require('command-line-args');

const parser = commandlineArgs([
  {name: 'force', alias: 'F', type: Boolean,
    description: '強制的にDBスキーマを再作成するか'},
  {name: 'token', alias: 't', type: String, required: true,
    description: 'SlackのAPIトークン'},
  {name: 'reminder-channel', alias: 'c', type: String,
    description: 'リマインダを送信するチャネルの名称'},
  {name: 'help', alias: 'h', type: Boolean,
    description: 'ヘルプを表示する'},
  {name: 'database-url', alias: 'd', type: String, required: true,
    description: 'データベースのURL(例: mysql://user:pass@localhost:3306/hx)'},
]);

const options = parser.parse(process.argv);
// console.log(options);
if (options.help) {
  console.log(parser.getUsage());
  process.exit(0);
}
const token = options.token;
if (!token) {
  console.log('トークンが指定されていません' + parser.getUsage());
  process.exit(1);
}
开发者ID:hxjp,项目名称:simekiri-bot,代码行数:31,代码来源:bot.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap