當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript yargs.showHelp函數代碼示例

本文整理匯總了TypeScript中yargs.showHelp函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript showHelp函數的具體用法?TypeScript showHelp怎麽用?TypeScript showHelp使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了showHelp函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: init

 public static init(opts: CLI): void {
   if (!opts.help) {
     this.start(opts).catch(err => {
       logger.error(err);
       process.exitCode = 1;
     });
   } else {
     yargs.showHelp();
     process.exitCode = 0;
   }
 }
開發者ID:krishnasrinivas,項目名稱:wetty,代碼行數:11,代碼來源:index.ts

示例2: tsxWrapper

(() => {
    if (!isScriptCalledDirectly()) {
        return
    }

    const argv = yargsLib
        .usage('$0 <cmd> [args]')
        .command('solConcat <solidityInputFile> <outputDirectory> [options]', 'create one solidity file from solidity source code including imports', solConcatArgs, solConcatWrapper)
        .command('solBuild <solidityInputFile> <outputDirectory> [options]', 'compile solidity contract', solBuildArgs, solBuildWrapper)
        .command('tsxBuild <inputRootDir> <inputFile> <outputDirectory> [options]', 'build GUI', tsxBuildWatchArgs, tsxWrapper(tsxBuild))
        .command('tsxWatch <inputRootDir> <inputFile> <outputDirectory> [options]', 'watch project an rebuild on changes', tsxBuildWatchArgs, tsxWrapper(tsxWatch))
        .command('cssTypeBuild <inputRootDir> [options]', 'build css TS type definitions', cssTypeBuildWatchArgs, cssTypeWrapper(cssTypeBuild))
        .command('cssTypeWatch <inputRootDir> [options]', 'watch css TS type definitions', cssTypeBuildWatchArgs, cssTypeWrapper(cssTypeWatch))
        .strict()
        .help()
        .argv

    // show help when no parameters passed
    if (!argv._[0]) {
        yargsLib.showHelp()
    }
})()
開發者ID:ondratra,項目名稱:soliditySapper,代碼行數:22,代碼來源:index.ts

示例3:

function Argv$showHelpConsoleLevel() {
    yargs.showHelp("log"); // prints to stdout using console.log()
}
開發者ID:markusmauch,項目名稱:DefinitelyTyped,代碼行數:3,代碼來源:yargs-tests.ts

示例4: switch

  })
  .command("uninstall", "Uninstall a system or plugin", (yargs) => {
    yargs.demand(2, 2, `The "uninstall" command requires a single argument: "systemId" or "systemId:pluginAuthor/pluginName"`).argv;
  })
  .command("update", "Update the server, a system or a plugin", (yargs) => {
    yargs.demand(2, 2, `The "update" command requires a single argument: server, "systemId" or "systemId:pluginAuthor/pluginName"`).argv;
  })
  .command("init", "Generate a skeleton for a new system or plugin", (yargs) => {
    yargs.demand(2, 2, `The "init" command requires a single argument: "systemId" or "systemId:pluginAuthor/pluginName"`).argv;
  })
  .help("h").alias("h", "help")
  .argv;

const command = argv._[0];
const [ systemId, pluginFullName ] = argv._[1] != null ? argv._[1].split(":") : [ null, null ];
switch (command) {
  /* tslint:disable */
  case "start": require("./commands/start").default(dataPath); break;
  case "list": require("./commands/list").default(); break;
  case "registry": require("./commands/registry").default(); break;
  case "install": require("./commands/install").default(systemId, pluginFullName); break;
  case "uninstall": require("./commands/uninstall").default(systemId, pluginFullName); break;
  case "update": require("./commands/update").default(systemId, pluginFullName); break;
  case "init": require("./commands/init").default(systemId, pluginFullName); break;
  /* tslint:enable */
  default:
    yargs.showHelp();
    process.exit(1);
    break;
}
開發者ID:AndreLewin,項目名稱:superpowers-core,代碼行數:30,代碼來源:index.ts


注:本文中的yargs.showHelp函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。