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

TypeScript yargs.usage函数代码示例

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

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



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

示例1: gpgMockCli

export function gpgMockCli(args: string[]): void {
  const state = GpgMockState.create();
  let y = yargs.usage('$0 <cmd> [args]');
  y = y.options({
    'with-colons': { describe: 'output in colons format', boolean: true },
    batch: { describe: 'no interactive processing', boolean: true },
    import: { describe: 'import key from stdin', boolean: true },
    homedir: { describe: 'the gpg database base directory', type: 'string' },
    'passphrase-fd': { describe: 'positional fd inputs', type: 'array' },
    version: { describe: 'prints version', boolean: true }
  });
  state.onParsed(
    (_y: yargs.Arguments, _state: GpgMockState): boolean => {
      if (_y.version) {
        // const version = fs.readFileSync('./')
        _state.stdout('gpg-mock (2.1.14)');
        return true;
      }
      return false;
    }
  );
  y = listSecretKeysCli(y, state);
  y = fullGenKeyCli(y, state);
  y = simpleActionsCli(y, state);
  y = agentCli(y, state);
  y = cardStatusCli(y, state);
  y = y.help().showHelpOnFail(true);
  y.parse(args.slice(2), (err: any, argv: yargs.Arguments, output: any) => {
    state.parsed(argv);
  });
}
开发者ID:mabels,项目名称:clavator,代码行数:31,代码来源:gpg-mock.ts


示例2: if

function Argv$reset() {
    let ya = yargs
        .usage('$0 command')
        .command('hello', 'hello command')
        .command('world', 'world command')
        .demand(1, 'must provide a valid command');
    let argv = yargs.argv;
    let command = argv._[0];

    if (command === 'hello') {
        ya.reset()
            .usage('$0 hello')
            .help('h')
            .example('$0 hello', 'print the hello message!')
            .argv;

        console.log('hello!');
    } else if (command === 'world') {
        ya.reset()
            .usage('$0 world')
            .help('h')
            .example('$0 world', 'print the world message!')
            .argv;

        console.log('world!');
    } else {
        ya.showHelp();
    }
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:29,代码来源:yargs-tests.ts


示例3: command

function command() {
	var argv = yargs
		.usage('npm <command>')
		.command('install', 'tis a mighty fine package to install')
		.command('publish', 'shiver me timbers, should you be sharing all that', yargs => {
			argv = yargs.option('f', {
				alias: 'force',
				description: 'yar, it usually be a bad idea'
			})
				.help('help')
				.argv;
		})
		.command("build", "arghh, build it mate", {
			tag: {
				default: true,
				demand: true,
				description: "Tag the build, mate!"
			},
			publish: {
				default: false,
				description:"Should i publish?"
			}
		})
		.help('help')
		.argv;
}
开发者ID:CNManning,项目名称:DefinitelyTyped,代码行数:26,代码来源:yargs-tests.ts


示例4: divide

// Tell users how to use yer options and make demands.
function divide() {
    let argv = yargs
        .usage('Usage: $0 -x [num] -y [num]')
        .demand(['x', 'y'])
        .argv;

    console.log(argv.x / argv.y);
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:9,代码来源:yargs-tests.ts


示例5:

function Argv$showHelpOnFail() {
    let argv = yargs
        .usage('Count the lines in a file.\nUsage: $0')
        .demand('f')
        .alias('f', 'file')
        .describe('f', 'Load a file')
        .showHelpOnFail(false, "Specify --help for available options")
        .argv;
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:9,代码来源:yargs-tests.ts


示例6: line_count

// Yargs is here to help you...
function line_count() {
    let argv = yargs
        .usage('Count the lines in a file.\nUsage: $0')
        .example('$0 -f', 'count the lines in the given file')
        .demand('f')
        .alias('f', 'file')
        .describe('f', 'Load a file')
        .argv
        ;
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:11,代码来源:yargs-tests.ts


示例7: readCommandLine

export function readCommandLine(extraOptions?: {[key: string]: any}) {
  const options: {[key: string]: any} = {
    'bundles': {describe: 'Whether to use the angular bundles or not.', default: false}
  };
  for (const key in extraOptions) {
    options[key] = extraOptions[key];
  }

  cmdArgs = yargs.usage('Angular e2e test options.').options(options).help('ng-help').wrap(40).argv;
  return cmdArgs;
}
开发者ID:AlmogShaul,项目名称:angular,代码行数:11,代码来源:e2e_util.ts


示例8: createYargsOption

const main = () => {
    const program = yargs
        .usage(
            "Usage: gulp util:new-language --language-name <language-name> " +
                "--language-extension <language-extension> --base-name <base-name>",
        )
        .option(
            "language-name",
            createYargsOption({
                alias: "n",
                describe: "name of the language to add",
            }),
        )
        .option(
            "language-extension",
            createYargsOption({
                alias: "e",
                coerce: extensionFormatCheck,
                describe: "extension for language files",
            }),
        )
        .option(
            "base-name",
            createYargsOption({
                alias: "b",
                describe: "pre-existing language to use as a base",
            }),
        ).argv;

    const name = program.languageName;
    const extension = program.languageExtension;
    const baseName = program.baseName;
    const baseExtension = program.baseExtension;

    console.log(`Making new language with name '${name}' and extension '${extension}'.`);
    console.log(`Basing it off of name '${baseName}' and extension '${baseExtension}'.`);

    createNewLanguage(
        {
            extension,
            name,
        },
        {
            extension: baseExtension,
            name: baseName,
        },
    );
};
开发者ID:HighSchoolHacking,项目名称:GLS,代码行数:48,代码来源:createNewLanguage.ts


示例9:

function Argv$usage_as_default_command() {
    const argv = yargs
        .usage(
        "$0 get",
        'make a get HTTP request',
        (yargs) => {
            return yargs.option('u', {
                alias: 'url',
                describe: 'the URL to make an HTTP request to'
            });
        },
        (argv) => {
            console.dir(argv.url);
        }
        )
        .argv;
}
开发者ID:Engineer2B,项目名称:DefinitelyTyped,代码行数:17,代码来源:yargs-tests.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript yargs.wrap函数代码示例发布时间:2022-05-25
下一篇:
TypeScript yargs.terminalWidth函数代码示例发布时间: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