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


TypeScript terminal.red方法代碼示例

本文整理匯總了TypeScript中@angular-devkit/core.terminal.red方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript terminal.red方法的具體用法?TypeScript terminal.red怎麽用?TypeScript terminal.red使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular-devkit/core.terminal的用法示例。


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

示例1: resolve

 .on('close', (code: number) => {
   if (code === 0) {
     logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
     resolve();
   } else {
     const message = 'Package install failed, see above.';
     logger.info(terminal.red(message));
     reject(message);
   }
 });
開發者ID:DevIntent,項目名稱:angular-cli,代碼行數:10,代碼來源:npm-install.ts

示例2:

 color = (x) => terminal.bold(terminal.red(x));
開發者ID:nickroberts,項目名稱:angular-cli,代碼行數:1,代碼來源:index.ts

示例3:

 fatal: s => terminal.bold(terminal.red(s)),
開發者ID:angular,項目名稱:angular-cli,代碼行數:1,代碼來源:index.ts

示例4:

 color = (x: string) => terminal.bold(terminal.red(x));
開發者ID:angular,項目名稱:angular-cli,代碼行數:1,代碼來源:main.ts

示例5: _executeTarget

async function _executeTarget(
  parentLogger: logging.Logger,
  workspace: experimental.workspace.Workspace,
  root: string,
  argv: minimist.ParsedArgs,
  registry: json.schema.SchemaRegistry,
) {
  const architectHost = new WorkspaceNodeModulesArchitectHost(workspace, root);
  const architect = new Architect(architectHost, registry);

  // Split a target into its parts.
  const targetStr = argv._.shift() || '';
  const [project, target, configuration] = targetStr.split(':');
  const targetSpec = { project, target, configuration };

  delete argv['help'];
  delete argv['_'];

  const logger = new logging.Logger('jobs');
  const logs: logging.LogEntry[] = [];
  logger.subscribe(entry => logs.push({ ...entry, message: `${entry.name}: ` + entry.message }));

  const run = await architect.scheduleTarget(targetSpec, argv, { logger });
  const bars = new MultiProgressBar<number, BarInfo>(':name :bar (:current/:total) :status');

  run.progress.subscribe(
    update => {
      const data = bars.get(update.id) || {
        id: update.id,
        builder: update.builder,
        target: update.target,
        status: update.status || '',
        name: ((update.target ? _targetStringFromTarget(update.target) : update.builder.name)
                + ' '.repeat(80)
              ).substr(0, 40),
      };

      if (update.status !== undefined) {
        data.status = update.status;
      }

      switch (update.state) {
        case BuilderProgressState.Error:
          data.status = 'Error: ' + update.error;
          bars.update(update.id, data);
          break;

        case BuilderProgressState.Stopped:
          data.status = 'Done.';
          bars.complete(update.id);
          bars.update(update.id, data, update.total, update.total);
          break;

        case BuilderProgressState.Waiting:
          bars.update(update.id, data);
          break;

        case BuilderProgressState.Running:
          bars.update(update.id, data, update.current, update.total);
          break;
      }

      bars.render();
    },
  );

  // Wait for full completion of the builder.
  try {
    const { success } = await run.output.pipe(
      tap(result => {
        if (result.success) {
          parentLogger.info(terminal.green('SUCCESS'));
        } else {
          parentLogger.info(terminal.yellow('FAILURE'));
        }
        parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));

        parentLogger.info('\nLogs:');
        logs.forEach(l => parentLogger.next(l));
        logs.splice(0);
      }),
    ).toPromise();

    await run.stop();
    bars.terminate();

    return success ? 0 : 1;
  } catch (err) {
    parentLogger.info(terminal.red('ERROR'));
    parentLogger.info('\nLogs:');
    logs.forEach(l => parentLogger.next(l));

    parentLogger.fatal('Exception:');
    parentLogger.fatal(err.stack);

    return 2;
  }
}
開發者ID:angular,項目名稱:angular-cli,代碼行數:98,代碼來源:architect.ts


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