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


TypeScript safe.yellow函数代码示例

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


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

示例1: commitLog

    export function commitLog(options: any) {
        if (!!options.quiet) log.silence();
        var repo = cwdRepo();
        log.header('Commit Log');

        var commit = repo.head.commit;
        var graph = !!options.graph;
        if (options.format === true) {
            log.error('unknown log format');
            return;
        }

        var format: string = options.format
            || (graph ? 'onelineWide' : 'short');
        format = Format.decodeFormat(format);

        if (!commit) {
            log.warn('No commits found.');
            return;
        }

        if (!!repo.merging) {
            log.warn('In merging mode, latest commits not shown.');
        }

        while (!!commit) {
            var nextCommit = commit.parent;

            var isLastCommit = nextCommit == null;
            var message = Format.formatCommitMessage(commit, format);

            if (graph) {
                var lines = message.split('\n');
                if (lines.length == 1) {
                    log.log(colors.yellow('*'), message);
                } else {
                    log.log(colors.yellow('*'), lines[0]);
                    for (var i = 1; i < lines.length; i++) {
                        if (isLastCommit) {
                            log.log('  ', lines[i]);
                        } else {
                            log.log(colors.red('|'), '', lines[i]);
                        }
                    }
                }
            } else {
                log.log(message);
                if (!isLastCommit) log.log();
            }

            commit = nextCommit;
        }
    }
开发者ID:STALKER2010,项目名称:jerk,代码行数:53,代码来源:cli.ts

示例2: printBalance

			await printBalance(async (balance) => {
				const amt = parseFloat(args[1]);
				const address = args[2];
				if (isNaN(amt)) {
					console.log(red('Must provide a valid number with maximum of 6 digits ie 10.356784'));
					process.exit(1);
				}
				if (!address) {
					console.log(red('Must provide a valid recipient address'));
					process.exit(1);
				}
				if  (amt > balance) {
					console.log(red(`You don't have enough ${MOSAIC_NAME} to send`));
					process.exit(1);
				}
				try {
					const preTransaction = await prepareTransfer(address, amt);
					const xemFee = (preTransaction.fee / 1e6).toString();
					console.log(white('Transaction Details: \n'));
					console.log(`Recipient:          ${yellow(address)}\n`);
					console.log(`${MOSAIC_NAME} to send:      ${yellow(amt.toString())}\n`);
					console.log(`XEM Fee:            ${yellow(xemFee)}\n\n`);
					console.log(`${white('Would you like to proceed?\n')}`);

					prompt.message = white(`${MOSAIC_NAME} Transfer`);
					prompt.start();
					prompt.get({
						properties: {
							confirmation: {
								description: yellow('Proceed? ( y/n )')
							}
						}
					}, async (_, result) => {
						if (result.confirmation.toLowerCase() === 'y' || result.confirmation.toLowerCase() === 'yes') {
							try {
								const result = await sendMosaic(address, amt, selectedAccount);
								console.log(result);
								console.log('\n\n');
								console.log(white('Transaction successfully announced to the NEM blockchain. Transaction could take some time. Come back here in 5 minutes to check your balance to ensure that the transaction was successfully sent\n'));

							} catch (err) {
								console.log(red(err));
							}
						} else {
							console.log('Transaction canceled');
							process.exit(1);
						}
					});
				} catch (err) {
					console.log(`\n${err}\n`);
				}
			});
开发者ID:devslopes,项目名称:mosaic-cli-wallet,代码行数:52,代码来源:wallet-cli.ts

示例3: async

const printBalance = async (onBalance: (balance: number) => void) => {
	const wallet = loadWallet();
	try {
		const account = await attemptWalletOpen(wallet);
		selectedAccount = account;
		console.log('\n');
		console.log(`\n${white('Public Address:')} ${white(account.address.pretty())}\n`);
		const spinner = new Spinner(yellow('Fetching balance... %s'));
		spinner.setSpinnerString(0);
		spinner.start();
		const balances = await getAccountBalances(account);
		const mosaic = await mosaicBalance(balances);
		const xem = await xemBalance(balances);
		spinner.stop();
		/**
		 * Convert raw number into user-readable string
		 * 1e6 is Scientific Notation - adds the decimal six
		 * places from the right: ie 156349876 => 156.349876
		 */
		const bal = (mosaic / 1e6).toString();
		const xemBal = (xem / 1e6).toString();
		console.log('\n');
		console.log(`\n${white('XEM Balance:')} ${white(xemBal)}`);
		console.log(`\n${white(`${MOSAIC_NAME} Balance:`)} ${white(bal)}\n`);
		onBalance(mosaic / 1e6);
	} catch (err) {
		if (err) {
			console.log(err);
		}
	}
};
开发者ID:devslopes,项目名称:mosaic-cli-wallet,代码行数:31,代码来源:wallet-cli.ts

示例4: status

    export function status(options: any) {
        if (!!options.quiet) log.silence();
        var repo = cwdRepo();
        var res = Client.status(repo);

        var mod = 'not modified';
        if (res.anyChanges) mod = 'modified';
        if (res.anyStagedChanges) mod += ', staged';
        if (!!repo.merging) {
            mod = 'merging';
        }
        var curCommit = repo.currentBranchName;
        if (!curCommit) {
            curCommit = 'HEAD #' + repo.head.head.substring(0, 7);
        }

        log.info(colors.blue(repo.name), '>', colors.yellow(curCommit), '>', colors.bold(mod));
        if (res.anyNewChanges) {
            log.info('changes not staged for commit:');

            res.modified.forEach(v => log.log(`    ${colors.red('modified:')}  ${v}`));
            res.added.forEach(v => log.log(`    ${colors.red('added:')}  ${v}`));
            res.removed.forEach(v => log.log(`    ${colors.red('removed:')}  ${v}`));
        }
        if (res.anyStagedChanges) {
            log.info('changes to be committed:');
            res.modifiedStaged.forEach(v => log.log(`    ${colors.green('modified:')}  ${v}`));
            res.addedStaged.forEach(v => log.log(`    ${colors.green('added:')}  ${v}`));
            res.removedStaged.forEach(v => log.log(`    ${colors.green('removed:')}  ${v}`));
        }
    }
开发者ID:STALKER2010,项目名称:jerk,代码行数:31,代码来源:cli.ts

示例5: endReport

 }).then(function(){
     console.log();
     console.log('All tests: ' + count + ', failed: ' + colors.yellow(failed.toString()) + ', succeeded: ' + colors.green(successful.toString()));
     endReport(saveReport);
     process.exitCode = failed>0?1:0
     process.chdir(__dirname);  // allow temp dir to be removed
 });
开发者ID:gliviu,项目名称:dir-compare,代码行数:7,代码来源:runTests.ts

示例6:

export const setOrDetectLocale = (locale: Maybe<string>) => {
  let how = LocalType.Specified;
  if (!locale) {
    how = LocalType.Detected;
    locale = osLocale.sync();
  }
  locale = locale.substr(0, 2);
  if (!isSupported(locale)) {
    console.warn(colors.yellow(`===== locale ${locale} ${how} but not supported, default: en =====`));
    return;
  }
  i18n.setLocale(locale);
};
开发者ID:iurimatias,项目名称:embark-framework,代码行数:13,代码来源:i18n.ts

示例7: white

const createPwd = () => {
	console.log(white(
		`\nPlease enter a unique password ${yellow('(8 character minimum)')}.\n 
This password will be used to encrypt your private key and make working with your wallet easier.\n\n`
	));
	console.log(red(
		`Store this password somewhere safe. If you lose or forget it you will never be able to transfer funds\n`
	));
	prompt.message = white(`${MOSAIC_NAME} wallet`);
	prompt.start();
	prompt.get({
		properties: {
			password: {
				description: white('Password'),
				hidden: true
			},
			confirmPass: {
				description: white('Re-enter password'),
				hidden: true
			}
		}
	}, async (_, result) => {
		if (result.password !== result.confirmPass) {
			console.log(magenta('\nPasswords do not match.\n\n'));
			createPwd();
		} else {
			/**
			 * Create new SimpleWallet
			 * Open it to access the new Account
			 * Print account info
			 */
			const wallet = createSimpleWallet(result.password);
			const pass = new Password(result.password);
			const account = wallet.open(pass);
			const address = account.address.pretty();
			console.log(green(`${MOSAIC_NAME} wallet successfully created.`));
			console.log(white(`You can now start sending and receiving ${MOSAIC_NAME}!`));
			console.log(white(`\n${MOSAIC_NAME} Public Address:`));
			console.log(yellow(`${address}`));
			console.log(white(`\nPrivate Key:`));
			console.log(yellow(`${account.privateKey}`));
			await downloadWallet(wallet);
		}
	})
};
开发者ID:devslopes,项目名称:mosaic-cli-wallet,代码行数:45,代码来源:wallet-cli.ts

示例8: passed

function passed (value, type) {
    count++;
    if (value) {
        successful++;
    } else {
        failed++;
    }

    if(type==='sync'){
        syncCount++;
        if (value) {
            syncSuccessful++;
        } else {
            syncFailed++;
        }
    }

    if(type==='async'){
        asyncCount++;
        if (value) {
            asyncSuccessful++;
        } else {
            asyncFailed++;
        }
    }

    if(type==='cmdLine'){
        cmdLineCount++;
        if (value) {
            cmdLineSuccessful++;
        } else {
            cmdLineFailed++;
        }
    }

    return value ? colors.green('Passed') : colors.yellow('!!!!FAILED!!!!');
}
开发者ID:gliviu,项目名称:dir-compare,代码行数:37,代码来源:runTests.ts

示例9: cloneOnConfigFetched

    function cloneOnConfigFetched(cfg: string) {
        var json: string = fs.readFileSync(cfg, 'utf8');

        let config: {
            defaultBranchName: string,
            refs: Object,
            commits: Object,
        } = JSON.parse(json);

        let nconfig = {
            defaultBranchName: config.defaultBranchName,
            currentBranchName: config.defaultBranchName,
            refs: config.refs,
            commits: config.commits,
            staged: []
        };

        var json = JSON.stringify(nconfig);
        fse.outputFileSync(cfg, json);

        let repo = new Common.Repo(process.cwd());
        repo.saveConfig();
        log.info(repo.name + ':', colors.yellow('' + repo.commits.length), 'commits');
    }
开发者ID:STALKER2010,项目名称:jerk,代码行数:24,代码来源:cli.ts


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