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

TypeScript yargs.option函数代码示例

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

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



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

示例1: main

async function main() {
  const args: any = yargs
    .option("publisher", {
      alias: ["p"],
    }).argv

  const tmpDir = new TmpDir()
  const targetDir = process.cwd()
  const tempPrefix = path.join(await tmpDir.getTempFile(""), sanitizeFileName(args.publisher))
  const cer = `${tempPrefix}.cer`
  const pvk = `${tempPrefix}.pvk`

  log('When asked to enter a password ("Create Private Key Password"), please select "None".')

  const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
  await exec(path.join(vendorPath, "makecert.exe"),
    ["-r", "-h", "0", "-n", `CN=${args.publisher}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])

  const pfx = path.join(targetDir, `${sanitizeFileName(args.publisher)}.pfx`)
  await unlinkIfExists(pfx)
  await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
  log(`${pfx} created. Please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing how do use it to sign.`)

  const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
  log(`${pfx} will be imported into ${certLocation} Operation will be succeed only if runned from root. Otherwise import file manually.`)
  await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
  tmpDir.cleanup()
}
开发者ID:mbrainiac,项目名称:electron-builder,代码行数:28,代码来源:create-self-signed-cert.ts


示例2: listSecretKeysCli

export function listSecretKeysCli(y: yargs.Argv, state: GpgMockState): yargs.Argv {
  state.onParsed(action);
  return yargs.option('list-secret-keys', {
    describe: 'list secret keys',
    boolean: true
  });
}
开发者ID:mabels,项目名称:clavator,代码行数:7,代码来源:list-secret-keys.ts


示例3: fullGenKeyCli

export function fullGenKeyCli(y: yargs.Argv, state: GpgMockState): yargs.Argv {
  state.onParsed(action);
  return yargs.option('full-gen-key', {
    describe: 'full-gen-key action',
    boolean: true
  });
}
开发者ID:mabels,项目名称:clavator,代码行数:7,代码来源:full-gen-key.ts


示例4: function

function Argv$getCompletion() {
	var ya = yargs
		.option('foobar', {})
		.option('foobaz', {})
		.completion()
		.getCompletion(['./test.js', '--foo'], function (completions) {
			console.log(completions)
		})
		.argv
}
开发者ID:longlho,项目名称:DefinitelyTyped,代码行数:10,代码来源:yargs-tests.ts


示例5:

function Argv$getCompletion() {
    let ya = yargs
        .option('foobar', {})
        .option('foobaz', {})
        .completion()
        .getCompletion(['./test.js', '--foo'], (completions) => {
            console.log(completions);
        })
        .argv;
}
开发者ID:markusmauch,项目名称:DefinitelyTyped,代码行数:10,代码来源:yargs-tests.ts


示例6: consoleReporter

(() => {
    const identityCommandBuilder = _.identity;
    return yargs
        .option('contracts-dir', {
            type: 'string',
            default: DEFAULT_CONTRACTS_DIR,
            description: 'path of contracts directory to compile',
        })
        .option('network-id', {
            type: 'number',
            default: DEFAULT_NETWORK_ID,
            description: 'mainnet=1, kovan=42, testrpc=50',
        })
        .option('should-optimize', {
            type: 'boolean',
            default: DEFAULT_OPTIMIZER_ENABLED,
            description: 'enable optimizer',
        })
        .option('artifacts-dir', {
            type: 'string',
            default: DEFAULT_ARTIFACTS_DIR,
            description: 'path to write contracts artifacts to',
        })
        .option('jsonrpc-url', {
            type: 'string',
            default: DEFAULT_JSONRPC_URL,
            description: 'url of JSON RPC',
        })
        .option('gas-price', {
            type: 'string',
            default: DEFAULT_GAS_PRICE,
            description: 'gasPrice to be used for transactions',
        })
        .option('account', {
            type: 'string',
            description: 'account to use for deploying contracts',
        })
        .option('contracts', {
            type: 'string',
            default: DEFAULT_CONTRACTS_LIST,
            description: 'comma separated list of contracts to compile',
        })
        .command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync))
        .command(
            'deploy',
            'deploy a single contract with provided arguments',
            deployCommandBuilder,
            consoleReporter(onDeployCommandAsync),
        )
        .help().argv;
})();
开发者ID:ewingrj,项目名称:0x-monorepo,代码行数:51,代码来源:cli.ts


示例7: mainNgcc

export function mainNgcc(args: string[]): number {
  const options =
      yargs
          .option('s', {
            alias: 'source',
            describe: 'A path to the root folder to compile.',
            default: './node_modules'
          })
          .option('f', {
            alias: 'formats',
            array: true,
            describe: 'An array of formats to compile.',
            default: ['fesm2015', 'esm2015', 'fesm5', 'esm5']
          })
          .option('t', {
            alias: 'target',
            describe: 'A path to a root folder where the compiled files will be written.',
            defaultDescription: 'The `source` folder.'
          })
          .help()
          .parse(args);

  const sourcePath: string = path.resolve(options['s']);
  const formats: EntryPointFormat[] = options['f'];
  const targetPath: string = options['t'] || sourcePath;

  const transformer = new Transformer(sourcePath, targetPath);
  const host = new DependencyHost();
  const resolver = new DependencyResolver(host);
  const finder = new EntryPointFinder(resolver);

  try {
    const {entryPoints} = finder.findEntryPoints(sourcePath);
    entryPoints.forEach(entryPoint => {
      // We transform the d.ts typings files while transforming one of the formats.
      // This variable decides with which of the available formats to do this transform.
      // It is marginally faster to process via the flat file if available.
      const dtsTranformFormat: EntryPointFormat = entryPoint.fesm2015 ? 'fesm2015' : 'esm2015';
      formats.forEach(
          format => transformer.transform(entryPoint, format, format === dtsTranformFormat));
    });
  } catch (e) {
    console.error(e.stack);
    return 1;
  }

  return 0;
}
开发者ID:foresthz,项目名称:angular,代码行数:48,代码来源:main.ts


示例8: main

async function main() {
  const args: any = yargs
    .option("arch", {
      choices: ["ia32", "x64", "all"],
    }).argv

  const projectDir = process.cwd()
  const devPackageFile = path.join(projectDir, "package.json")

  const devMetadata: DevMetadata = await readPackageJson(devPackageFile)
  const results: Array<string> = await BluebirdPromise.all([
    computeDefaultAppDirectory(projectDir, use(getDirectoriesConfig(devMetadata), it => it!.app)),
    getElectronVersion(devMetadata, devPackageFile)
  ])

  // if two package.json — force full install (user wants to install/update app deps in addition to dev)
  await installOrRebuild(devMetadata.build, results[0], results[1], args.arch, results[0] !== projectDir)
}
开发者ID:heinzbeinz,项目名称:electron-builder,代码行数:18,代码来源:install-app-deps.ts


示例9: mainNgcc

export function mainNgcc(args: string[]): number {
  const options =
      yargs
          .option('s', {
            alias: 'source',
            describe: 'A path to the root folder to compile.',
            default: './node_modules'
          })
          .option('f', {
            alias: 'formats',
            array: true,
            describe: 'An array of formats to compile.',
            default: ['fesm2015', 'esm2015', 'fesm5', 'esm5']
          })
          .option('t', {
            alias: 'target',
            describe: 'A path to a root folder where the compiled files will be written.',
            defaultDescription: 'The `source` folder.'
          })
          .help()
          .parse(args);

  const sourcePath: string = path.resolve(options['s']);
  const formats: EntryPointFormat[] = options['f'];
  const targetPath: string = options['t'] || sourcePath;

  const transformer = new Transformer(sourcePath, targetPath);
  const host = new DependencyHost();
  const resolver = new DependencyResolver(host);
  const finder = new EntryPointFinder(resolver);

  try {
    const {entryPoints} = finder.findEntryPoints(sourcePath);
    entryPoints.forEach(
        entryPoint => formats.forEach(format => transformer.transform(entryPoint, format)));
  } catch (e) {
    console.error(e.stack);
    return 1;
  }

  return 0;
}
开发者ID:KaneFreeman,项目名称:angular,代码行数:42,代码来源:main.ts


示例10: main

async function main() {
  const args: any = yargs
    .option("platform", {
      choices: ["linux", "darwin", "win32"],
      default: process.platform,
    })
    .option("arch", {
      choices: ["ia32", "x64", "all"],
      default: process.arch,
    })
    .argv

  const projectDir = process.cwd()
  const config = (await loadConfig(projectDir)) || {}
  const results: Array<string> = await BluebirdPromise.all([
    computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
    getElectronVersion(config, projectDir)
  ])

  // if two package.json — force full install (user wants to install/update app deps in addition to dev)
  await installOrRebuild(config, results[0], results[1], args.platform, args.arch, results[0] !== projectDir)
}
开发者ID:mbrainiac,项目名称:electron-builder,代码行数:22,代码来源:install-app-deps.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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