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

TypeScript yargs类代码示例

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

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



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

示例1: yargs

export = (argv) => yargs(argv)
	.usage(i18n('Usage: $0 <command> [globs...] [<options>]'))
	.command({
		builder,
		command: 'check [globs...]',
		describe: i18n('Validate that file(s) adhere to .editorconfig settings'),
		handler: check,
	})
	.command({
		builder: (fixArgv) => (
			builder(fixArgv).option('dest', {
				alias: 'd',
				describe: i18n('Destination folder to pipe source files'),
				type: 'string',
			})
		),
		command: 'fix   [globs...]',
		describe: i18n('Fix formatting errors that disobey .editorconfig settings'),
		handler: fix,
	})
	.command({
		builder: inferBuilder,
		command: 'infer [globs...]',
		describe: i18n('Infer .editorconfig settings from one or more files'),
		handler: infer,
	})
	.demandCommand(1, 1, i18n('CommandError: Missing required sub-command.'))
	.help()
	.version(pkg.version)
	.argv;
开发者ID:jedmao,项目名称:eclint,代码行数:30,代码来源:cli.ts


示例2: convert

    convert(target: string, collectionId: string): Record {

        const content = this.prepare(target);
        const args = yargs([content]);

        const url = this.parseUrl(args);
        const headers = this.parseHeaders(args);
        const body = this.parseBody(args, headers);
        const method = this.parseMethod(args, body);

        return RecordService.fromDto({
            id: StringUtil.generateUID(),
            collectionId,
            category: RecordCategory.record,
            name: url,
            parameterType: ParameterType.ManyToMany,
            method,
            body,
            headers,
            url
        });
    }
开发者ID:winken168,项目名称:Hitchhiker,代码行数:22,代码来源:curl_import.ts


示例3: Argv_parsing

function Argv_parsing() {
    let argv1 = yargs.argv;
    let argv2 = yargs(['-x', '1', '-y', '2']).argv;
    let argv3 = yargs.parse(['-x', '1', '-y', '2']);
    console.log(argv1.x, argv2.x, argv3.x);
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:6,代码来源:yargs-tests.ts


示例4: constructFilename

import {
    makeApplicationUrn,
    MessageSecurityMode,
    nodesets,
    OPCUAServer,
    SecurityPolicy,
    ServerSession
} from "node-opcua";

Error.stackTraceLimit = Infinity;

function constructFilename(filename: string): string {
    return path.join(__dirname, "../", filename);
}

const argv = yargs(process.argv)
.wrap(132)

  .option("alternateHostname", {
      alias: "a",
      describe: "alternateHostname"
  })

  .option("port", {
      alias: "p",
      default: 26543
  })

  .option("silent", {
      alias: "s",
      default: false,
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:simple_secure_server.ts


示例5: require

import * as fs from 'fs';
import * as path from 'path';
const ncu = require('npm-check-updates');
import * as semver from 'semver';
import * as yargs from 'yargs';
import {loadFrameworkVersionInformation, determineInstalledVersions, FrameworkVersionInformation, FrameworkVersionInformationStatic, FrameworkVersionInformationDynamic, FrameworkVersionInformationError,
    PackageVersionInformation, PackageVersionInformationValid, PackageVersionInformationErrorUnknownPackage, PackageVersionInformationErrorNoPackageJSONLock, PackageVersionInformationResult} from './common';

let args = yargs(process.argv)
    .usage("$0 --updade true|false")
    .default('update', 'true')
    .boolean('update').argv;

let updatePackages = args.update;

async function ncuReportsUpdatedVersion(packageVersionInfo: PackageVersionInformationResult) {
    let ncuInfo = await ncu.run({
        packageFile: path.resolve('..', 'frameworks', packageVersionInfo.framework.keyedType, packageVersionInfo.framework.directory, 'package.json'),
        silent: true,
        jsonUpgraded: true,
        loglevel: 'silent'
    });
    if (ncuInfo) {
        return packageVersionInfo.versions.filter((pi: PackageVersionInformationValid) => ncuInfo[pi.packageName])
            .some((pi: PackageVersionInformationValid) => {
                let newVersion = ncuInfo[pi.packageName];
                if (newVersion.startsWith('^')) newVersion = newVersion.substring(1);
                if ( newVersion.startsWith('~')) newVersion = newVersion.substring(1);
                if (newVersion) {
                    return !semver.satisfies(newVersion, '~'+pi.version);
                } else {
开发者ID:localvoid,项目名称:js-framework-benchmark,代码行数:31,代码来源:updateFrameworks.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript yargs-parser类代码示例发布时间:2022-05-28
下一篇:
TypeScript xtend类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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