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

TypeScript colors.green函数代码示例

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

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



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

示例1: clientAdd

    /**
     * Add a registered referrer.
     *
     * @param  {Object} yargs
     * @return {void}
     */
    clientAdd(yargs): void {
        var options = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
        var appId = yargs.argv._[1] || this.createAppId();
        options.clients = options.clients || [];

        if (appId) {
            var index = null;
            var client = options.clients.find((client, i) => {
                index = i;
                return client.appId == appId;
            });

            if (client) {
                client.key = this.createApiKey();

                options.clients[index] = client;

                console.log(colors.green('API Client updated!'));
            } else {
                client = {
                    appId: appId,
                    key: this.createApiKey()
                };

                options.clients.push(client);

                console.log(colors.green('API Client added!'));
            }

            console.log(colors.magenta('appId: ' + client.appId));
            console.log(colors.magenta('key: ' + client.key))

            this.saveConfig(options);
        }
    }
开发者ID:skatetdieu,项目名称:laravel-echo-server,代码行数:41,代码来源:cli.ts


示例2: consoleTestResultHandler

export function consoleTestResultHandler(testResult: TestResult): boolean {
    let didAllTestsPass = true;

    for (const fileName of Object.keys(testResult.results)) {
        const results = testResult.results[fileName];
        process.stdout.write(`${fileName}:`);

        const diffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
        const didTestPass = !diffResults.some((diff) => diff.added || diff.removed);

        /* tslint:disable:no-console */
        if (didTestPass) {
            console.log(colors.green(" Passed"));
        } else {
            console.log(colors.red(" Failed!"));
            console.log(colors.green(`Expected (from ${FILE_EXTENSION} file)`));
            console.log(colors.red("Actual (from TSLint)"));

            didAllTestsPass = false;

            for (const diffResult of diffResults) {
                let color = colors.grey;
                if (diffResult.added) {
                    color = colors.green;
                } else if (diffResult.removed) {
                    color = colors.red;
                }
                process.stdout.write(color(diffResult.value));
            }
        }
        /* tslint:enable:no-console */
    }

    return didAllTestsPass;
}
开发者ID:arnaudvalle,项目名称:tslint,代码行数:35,代码来源:test.ts


示例3: finalize

/**
 * Calls any external programs to finish setting up the library
 */
function finalize() {
  console.log(colors.underline.white("Finalizing"))

  // Recreate Git folder
  let gitInitOutput = exec('git init "' + path.resolve(__dirname, "..") + '"', {
    silent: true
  }).stdout
  console.log(colors.green(gitInitOutput.replace(/(\n|\r)+/g, "")))

  // Remove post-install command
  let jsonPackage = path.resolve(__dirname, "..", "package.json")
  const pkg = JSON.parse(readFileSync(jsonPackage) as any)

  // Note: Add items to remove from the package file here
  delete pkg.scripts.postinstall

  writeFileSync(jsonPackage, JSON.stringify(pkg, null, 2))
  console.log(colors.green("Postinstall script has been removed"))

  // Initialize Husky
  fork(
    path.resolve(__dirname, "..", "node_modules", "husky", "bin", "install"),
    { silent: true }
  );
  console.log(colors.green("Git hooks set up"))

  console.log("\n")
}
开发者ID:robertrbairdii,项目名称:typescript-library-starter,代码行数:31,代码来源:init.ts


示例4: async

const linkDist = async (pckg: IPackage) => {
  const modulesPackagePath = path.join(cwd, nodeModulesDir, pckg.name);
  const packageDistPath = path.join(pckg.path, packageDistDir);
  try {
    await pathExists(modulesPackagePath);
    console.info(colors.green(`${modulesPackagePath} exists`));
    try {
      await pathIsSymLink(modulesPackagePath);
      console.info(colors.green(`${modulesPackagePath} is a symbolic link`));
    } catch (e) {
      console.info(colors.magenta(`${modulesPackagePath} is not a symbolic link`));
      await removePath(packageDistPath);
      await copyPath(modulesPackagePath, packageDistPath);
      await removePath(modulesPackagePath);
      await symLinkPath(packageDistPath, modulesPackagePath);
    }
  } catch (e) {
    console.info(colors.magenta(`${modulesPackagePath} does not exist`));
    try {
      await pathExists(packageDistPath);
      console.info(colors.green(`${packageDistPath} exists`));
      await symLinkPath(packageDistPath, modulesPackagePath);
    } catch (e) {
      console.info(colors.magenta(`${packageDistPath} does not exist: create it`));
      await createPath(packageDistPath);
      await symLinkPath(packageDistPath, modulesPackagePath);
    }
  }
};
开发者ID:santech-org,项目名称:ng-on-rest,代码行数:29,代码来源:symlink.ts


示例5: startToolServer

export function startToolServer() {
  const app = express();

  app.get('/migration-user', (req, res) => {
    migrationUser();
    res.status(200).send();
  });

  app.get('/migration-todo', (req, res) => {
    migrationTodo();
    res.status(200).send();
  });

  app.get('/migration-task', async (req, res) => {
    await migrationTask();
    res.status(200).send();
  });

  app.get('/hash-passwd/:password', (req, res) => {
    const password = req.params.password;
    res.status(200).send(hashPasswd(password));
  });

  const server = http.createServer(app);
  const port = configure.getConfigByKey('TOOL_SERVE_PORT');
  server.listen(port, '127.0.0.1');

  // tslint:disable-next-line
  console.log(colors.green(`Octopus tool serve on http://127.0.0.1:${port}`));
}
开发者ID:A-Horse,项目名称:bblist-backend,代码行数:30,代码来源:tool-server.ts


示例6: consoleTestResultHandler

export function consoleTestResultHandler(testResult: TestResult): boolean {
    let didAllTestsPass = true;

    for (const fileName of Object.keys(testResult.results)) {
        const results = testResult.results[fileName];
        process.stdout.write(`${fileName}:`);

        const markupDiffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
        const fixesDiffResults = diff.diffLines(results.fixesFromLinter, results.fixesFromMarkup);
        const didMarkupTestPass = !markupDiffResults.some((diff) => !!diff.added || !!diff.removed);
        const didFixesTestPass = !fixesDiffResults.some((diff) => !!diff.added || !!diff.removed);

        /* tslint:disable:no-console */
        if (didMarkupTestPass && didFixesTestPass) {
            console.log(colors.green(" Passed"));
        } else {
            console.log(colors.red(" Failed!"));
            didAllTestsPass = false;
            if (!didMarkupTestPass) {
                displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION);
            }
            if (!didFixesTestPass) {
                displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION);
            }
        }
        /* tslint:enable:no-console */
    }

    return didAllTestsPass;
}
开发者ID:arusakov,项目名称:tslint,代码行数:30,代码来源:test.ts


示例7: clientRemove

    /**
     * Remove a registered referrer.
     *
     * @param  {object} yargs
     * @return {void}
     */
    clientRemove(yargs): void {
        yargs.option({
            config: {
                type: 'string',
                describe: 'The config file to use.',
            },

            dir: {
                type: 'string',
                describe: 'The working directory to use.',
            }
        });

        const options = this.readConfigFile(this.getConfigFile(yargs.argv.config, yargs.argv.dir));
        const appId = yargs.argv._[1] || null;
        options.clients = options.clients || [];

        let index = null;

        const client = options.clients.find((client, i) => {
            index = i;
            return client.appId == appId;
        });

        if (index >= 0) {
            options.clients.splice(index, 1);
        }

        console.log(colors.green('Client removed: ' + appId));

        this.saveConfig(options);
    }
开发者ID:tlaverdure,项目名称:laravel-echo-server,代码行数:38,代码来源:cli.ts


示例8: clientAdd

    /**
     * Add a registered referrer.
     *
     * @param  {object} yargs
     * @return {void}
     */
    clientAdd(yargs): void {
        yargs.option({
            config: {
                type: 'string',
                describe: 'The config file to use.',
            },

            dir: {
                type: 'string',
                describe: 'The working directory to use.',
            }
        });

        const options = this.readConfigFile(this.getConfigFile(yargs.argv.config, yargs.argv.dir));
        const appId = yargs.argv._[1] || this.createAppId();
        options.clients = options.clients || [];

        if (appId) {
            let index = null;
            let client = options.clients.find((client, i) => {
                index = i;
                return client.appId == appId;
            });

            if (client) {
                client.key = this.createApiKey();

                options.clients[index] = client;

                console.log(colors.green('API Client updated!'));
            } else {
                client = {
                    appId: appId,
                    key: this.createApiKey()
                };

                options.clients.push(client);

                console.log(colors.green('API Client added!'));
            }

            console.log(colors.magenta('appId: ' + client.appId));
            console.log(colors.magenta('key: ' + client.key))

            this.saveConfig(options);
        }
    }
开发者ID:tlaverdure,项目名称:laravel-echo-server,代码行数:53,代码来源:cli.ts


示例9: constructor

    constructor(options: {}, title: string, private controlToken: ProgressContolToken, private total?: number) {
        super(options);

        this.state = StreamState.preparing;

        this.haveTotal = typeof this.total === 'number';

        const progressWithTotal = rigthPad(2000, `  ${colors.green(title)} [{bar}]  `
            + `${colors.gray('{_value} / {_total} Mb')}   {percentage}%   {duration_formatted}`);

        const progressWithoutTotal = rigthPad(2000, `  ${colors.green(title)} ${colors.gray(' {_value} Mb')}` +
            `   {duration_formatted}`);

        this.progress = new cliProgress.Bar({
            format: this.haveTotal ? progressWithTotal : progressWithoutTotal,
            barsize: 40,
            etaBuffer: 50,
            hideCursor: false,
            clearOnComplete: true,
            linewrap: false,
            fps: 50,
        });

        this.completed = 0;

        this.once('end', () => {
            this.die();
        });

        this.on('pipe', () => {
            if (this.state !== StreamState.bypass && this.state !== StreamState.visible) {
                this.state = StreamState.connected;
            }
        });

        this.on('unpipe', () => {
            if (this.state !== StreamState.bypass) {
                this.toggleVisibility(false);
                this.state = StreamState.preparing;
            }
        });

        this.controlToken.toggleVisibility = (shouldBeVisibe) => this.toggleVisibility(shouldBeVisibe);
        this.controlToken.toggleBypass = (shouldBeVisibe) => this.toggleBypass(shouldBeVisibe);
        this.controlToken.terminate = () => this.die();
    }
开发者ID:mutantcornholio,项目名称:veendor,代码行数:46,代码来源:progress.ts


示例10: async

const checkModulePublished = async (pckg: IPackage) => {
  try {
    const version = require(path.join(pckg.path, packageJson)).version;
    console.info(colors.green(`${pckg.name} version ${version}`));
    const versions: string[] = JSON.parse(await execCmd(`yarn info ${pckg.name} versions --json`)).data;
    return versions.indexOf(version) >= 0;
  } catch (e) {
    console.error(colors.red(`Error : ${e}`));
    return false;
  }
};
开发者ID:santech-org,项目名称:ng-on-rest,代码行数:11,代码来源:publish.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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