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

TypeScript commandpost.create函数代码示例

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

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



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

示例1:

{
	replace: boolean;
	baseDir: string[];
	formattersDir: string[];
	dryRun: boolean;
	tslint: boolean;
	tslintRulesDir: string[];
	verbose: boolean;
}

interface RootArguments
{
	files: string[];
}

let root = commandpost
	.create<RootOptions, RootArguments>("ts-cfmt [files...]")
	.version(packageJson.version, "-v, --version")
	.option("-r, --replace", "replace .ts file")
	.option("--baseDir <path>", "config file lookup from <path>")
	.option("--formattersDir <path>", "formatters to use are looked up in <path>", "./formatters")
	.option("--no-tslint", "don't read a tslint.json")
	.option("--tslintRulesDir <path>", "tslint rules to use are looked up in <path>")
	.option("--dryRun", "outputs the changes to console")
	.option("--verbose", "makes output more verbose")
	.action((opts, args) =>
	{
		const replace = !!opts.replace;
		const baseDir = opts.baseDir ? opts.baseDir[0] : null;
		const formattersDir = opts.formattersDir ? opts.formattersDir[0] : null;
		const dryRun = !!opts.dryRun;
		const tslint = !!opts.tslint;
开发者ID:yaroslav0507,项目名称:CodeFormatter,代码行数:32,代码来源:Cli.ts


示例2:

    packageVersion: pkg.version
});
if (notifier.update) {
    notifier.notify();
}

let packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf8"));

import * as commandpost from "commandpost";

interface RootOpts {
    reviewfile: string[];
    base: string[];
}

let root = commandpost
    .create<RootOpts, {}>("reviewjs")
    .version(packageJson.version, "-v, --version")
    .option("--reviewfile <file>", "where is ReVIEWconfig.js?")
    .option("--base <path>", "alternative base path")
    .action(() => {
        process.stdout.write(root.helpText() + '\n');
    });

interface CompileOpts {
    ast: boolean;
    target: string[];
}

interface CompileArgs {
    document: string;
}
开发者ID:vvakame,项目名称:review.js,代码行数:32,代码来源:cli.ts


示例3:

"use strict";

import * as lib from "./index";

import * as fs from "fs";
let packageJson = JSON.parse(fs.readFileSync(__dirname + "/../package.json", "utf8"));
import * as commandpost from "commandpost";

interface RootOpts {
    word: string[];
}

let root = commandpost
    .create<RootOpts, {}>("tssample")
    .version(packageJson.version, "-v, --version")
    .option("--word <word>", "hi! <word>")
    .action((opts, args) => {
        process.stdout.write(lib.hi(opts.word[0]) + "\n");
        process.exit(0);
    });

commandpost.exec(root, process.argv);
开发者ID:HansS,项目名称:typescript-project-sample-vvakame,代码行数:22,代码来源:cli.ts


示例4: require

import * as commandpost from "commandpost";
import * as YAML from "js-yaml";
import { convert } from "./converter";

const pkg = require("../package.json");

interface RootOptions {
  /** @deprecated */
  stdin: boolean;
  output: string[];
  namespace: string[];
  withQuery: boolean;
  sortProps: boolean;
}

const root = commandpost
  .create<RootOptions, { input_filename: string }>("sw2dts [input_filename]")
  .version(pkg.version, "-v, --version")
  .option("-w, --with-query", "With GET query parameters.")
  .option("-s, --sort-props", "Sort type properties order.")
  .option("-o, --output <output_filename>", "Output to file.")
  .option("-n, --namespace <namespace>", "Use namespace.")
  .option("--stdin", "[Deprecated] Input from standard input.")
  .action(async (opts, args) => {
    // TODO Delete '--stdin' option.
    if (opts.stdin) {
      console.warn("'--stdin' option is deprecated.");
    }
    if (args.input_filename && opts.stdin) {
      process.stderr.write("Invalid parameters!\n");
      process.exit(1);
      return;
开发者ID:mstssk,项目名称:sw2dts,代码行数:32,代码来源:cli.ts


示例5: require

import htmlconv from './main';

interface RootOptions {
  encoding: string[];
  out: string[];
  patterns: string[];
  patternsText: string[];
  text: string[];
}

interface RootArgs {
  inputPath: string;
}

const pkg = require('../package.json');
const root = commandpost
  .create<RootOptions, RootArgs>('cw-htmlconv [inputPath]')
  .version(pkg.version, '-v, --version')
  .option('-o, --out [path]', 'Output to single file')
  .option('-p, --patterns [path]', 'JSON file of Definition for convert patterns')
  .option('-t, --text [html]', 'Raw HTML text that want to convert')
  .option('-v, --version', 'Print version')
  .option('--patterns-text [text]', 'JSON Definition for convert patterns')
  .action((opts, args, rest) => {
    // for Debug
    //console.log(opts, args, rest);

    const textPromise     = text(opts, args);
    const patternsPromise = patterns(opts);

    Promise.all([textPromise, patternsPromise])
      .then((values: any[]) => {
开发者ID:crescware,项目名称:cw-htmlconv,代码行数:32,代码来源:cli.ts


示例6: setup

import * as dtsm from "./";
import * as pmb from "packagemanager-backend";
import * as is from "./incrementalsearch";

import * as commandpost from "commandpost";
import * as archy from "archy";

interface RootOptions {
    offline: boolean;
    config: string[];
    remote: string[];
    insight: string[];
    ref: string[];
}

let root = commandpost
    .create<RootOptions, {}>("dtsm")
    .version(pkg.version, "-v, --version")
    .option("--insight <use>", "send usage opt in/out. in = `--insight true`, out = `--insight false`")
    .option("--offline", "offline first")
    .option("--remote <uri>", "uri of remote repository")
    .option("--config <path>", "path to json file")
    .option("--ref <ref>", "ref of repository")
    .action(() => {
        process.stdout.write(root.helpText() + '\n');
    });

root
    .subCommand("init")
    .description("make new dtsm.json")
    .action(() => {
        setup(root.parsedOpts)
开发者ID:ukyo,项目名称:dtsm,代码行数:32,代码来源:cli.ts


示例7:

import * as commandpost from "commandpost";

interface RootOptions {
    templateHtml?: string[];
    templateFile?: string[];
    componentFile?: string[];
    componentName?: string[];
    originUrl?: string[];
    baseUrl?: string[];
    reqUrl?: string[];
    outFile?: string[];
    preboot?: boolean;
}

let root = commandpost
    .create<RootOptions, {}>("ngssr")
    .version(pkg.version, "-v, --version")
    .usage(`ngssr --templateHtml "<app></app>" --componentFile ./example/app.component.js --componentName AppComponent`)
    .option("--templateHtml <templateHtml>", "string oftemplate html")
    .option("--templateFile <templateFile>", "path to template html file")
    .option("--componentFile <componentFile>", "path to component js file")
    .option("--componentName <componentName>", "component class name")
    .option("--originUrl <originUrl>", "specify origin url", "http://localhost:8080")
    .option("--baseUrl <baseUrl>", "specify base url", "/")
    .option("--reqUrl <reqUrl>", "specify request url", "/")
    .option("--outFile <outFile>", "output file of generated html")
    .option("--preboot", "turn on generating preboot code", false)
    .action(opts => {
        let templateFile = opts.templateFile[0] || "";
        let templateHtml = opts.templateHtml[0] || "";
        let componentFile = opts.componentFile[0] || "";
开发者ID:gdi2290,项目名称:ng-ssr-cli,代码行数:31,代码来源:cli.ts


示例8:

interface RootOpts {
    rulesJson: boolean;
    rulesYaml: boolean;
    replace: boolean;
    verify: boolean;
    stdout: boolean;
    diff: boolean;
    verbose: boolean;
    rules: string[];
}

interface RootArgs {
    files: string[];
}

const root = commandpost
    .create<RootOpts, RootArgs>("prh [files...]")
    .version(pkg.version, "-v, --version")
    .option("--rules-json", "emit rule set in json format")
    .option("--rules-yaml", "emit rule set in yaml format")
    .option("--rules <path>", "path to rule yaml file")
    .option("--verify", "checking file validity")
    .option("--stdout", "print replaced content to stdout")
    .option("--diff", "show unified diff")
    .option("--verbose", "makes output more verbose")
    .option("-r, --replace", "replace input files")
    .action((opts, args) => {

        if (opts.rulesJson || opts.rulesYaml) {
            if (opts.verbose) {
                console.warn(`processing ${process.cwd()} dir...`);
            }
开发者ID:vvakame,项目名称:prh,代码行数:32,代码来源:cli.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript commandpost.exec函数代码示例发布时间:2022-05-25
下一篇:
TypeScript reading.readLoosely函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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