当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript colors.magenta函数代码示例

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


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

示例1:

        this.setupConfig(yargs.argv.config).then(options => {
            options = Object.assign({}, this.defaultOptions, options);

            if (options.addClient) {
                const client = {
                    appId: this.createAppId(),
                    key: this.createApiKey()
                };
                options.clients.push(client);

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

            if (options.corsAllow) {
                options.apiOriginAllow.allowCors = true;
                options.apiOriginAllow.allowOrigin = options.allowOrigin;
                options.apiOriginAllow.allowMethods = options.allowMethods;
                options.apiOriginAllow.allowHeaders = options.allowHeaders;
            }

            this.saveConfig(options).then(file => {
                console.log('Configuration file saved. Run ' + colors.magenta.bold('laravel-echo-server start' + (file != 'laravel-echo-server.json' ? ' --config="' + file + '"' : '')) + ' to run server.');

                process.exit();
            }, error => {
                console.error(colors.error(error));
            });
        }, error => console.error(error));
开发者ID:tlaverdure,项目名称:laravel-echo-server,代码行数:29,代码来源:cli.ts

示例2: 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

示例3: 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

示例4: async

    Coinjar: async () => {
        const rates = await rp({ uri: 'https://api.coinjar.com/v3/exchange_rates', json: true });
        const usd = parseFloat(rates.exchange_rates.BTCUSD.midpoint);
        const aud = parseFloat(rates.exchange_rates.BTCAUD.midpoint);

        return {
            usd: {
                raw: usd,
                formatted: colors.red(`$${usd.toFixed(2)}USD`)
            },
            aud: {
                raw: aud,
                formatted: colors.magenta(`$${aud.toFixed(2)}AUD`)
            },
            notifier: () => {
                function notify(operator, target, price) {
                    notifier.notify({
                        title: `CoinJar Midpoint ${operator} $${target}`,
                        sound: true,
                        message: price
                    });
        
                    player.play('Morning_Flower.mp3', function(err) {
                        //console.log(`Could not play sound! Error: ${err}`);
                    });
                }

                if (aud <= priceLow) {
                    notify('<=', priceLow, aud);
                } else if (aud >= priceHigh) {
                    notify('=>', priceHigh, aud); 
                } 
            }
        };
    },
开发者ID:khell,项目名称:scrape-coinjar,代码行数:35,代码来源:index.ts

示例5: 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

示例6: applyColor

function applyColor(message: string, color: Color): string {
    if (!message) return;
    if (!color) return message;

    switch (color) {
        case Color.black:   return colors.black(message);
        case Color.red:     return colors.red(message);
        case Color.green:   return colors.green(message);
        case Color.yellow:  return colors.yellow(message);
        case Color.blue:    return colors.blue(message);
        case Color.magenta: return colors.magenta(message);
        case Color.cyan:    return colors.cyan(message);
        case Color.white:   return colors.white(message);
        case Color.grey:    return colors.grey(message);
        default:            throw new Error('Invalid Color');
    }
}
开发者ID:herculesinc,项目名称:credo.logger,代码行数:17,代码来源:ConsoleLogger.ts

示例7: verboset

export function verboset(str: string, ...args: Array<any>): void {
    if (logLevel >= LogLevel.verbose){
        console.log(colors.magenta('VERBOSE ') + str, ...args);
    }
}
开发者ID:uhyo,项目名称:my-static,代码行数:5,代码来源:log.ts


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