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


TypeScript safe.bold函数代码示例

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


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

示例1: pull

    export function pull(options: any) {
        if (!!options.quiet) log.silence();
        let repo = cwdRepo();

        let url = conf.get('repo_' + repo.name + '.url');
        if (!url) {
            log.error(`remote address not specified. Use ${colors.bold('jerk config set this.url <url>')} to set remote address to ${colors.italic('<url>')}`);
            return;
        }

        if (!repo.currentBranchName) {
            log.error(`you can not pull in detached HEAD state. Create new branch or use ${colors.bold('jerk fetch')}.`);
            return;
        }

        Client.fetch(repo, url, progressBarCallback(), (success) => {
            if (success) {
                let authorName: string = conf.get('authorName');
                let authorEMail: string = conf.get('authorEMail');
                var noAuthor = !authorName || !authorEMail;
                if (noAuthor) {
                    log.error('either author name or email is not specified!');
                    return;
                }
                let resolved = Client.resolveWhat(repo, 'FETCH_HEAD');
                Client.merge(repo, resolved.commit, 'Remote pull merging commit', authorName, authorEMail);
                log.success('pull finished successfully');
            } else {
                log.error('fetch failed');
            }
        });
    }
开发者ID:ssyp-ru,项目名称:ssyp16-ws13,代码行数:32,代码来源:cli.ts

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

示例3: checkout

    export function checkout(what: string, options: any) {
        if (!!options.quiet) log.silence();
        var repo = cwdRepo();

        let res = Client.resolveWhat(repo, what);
        if (!res.commit) {
            log.error('Commit or branch to checkout not found!');
            return;
        }

        if (options.force) {
            Client.revertAllWorkingTreeChanges(repo);
        } else if (!!repo.merging) {
            log.error(`You are in merging mode, specify ${colors.bold('--force')} or finish and commit merging results.`)
            return;
        }

        repo.setMerging(null, null);

        Client.checkout(repo, res.commit, (res.ref instanceof Common.Branch) ? res.ref : null);

        if (!repo.currentBranchName) {
            log.info("Detached HEAD");
            log.log("You have entered 'detached HEAD' state. You can look around, make experimental changes" +
                " and create new branch based on this commit to retain all changes you would like to make." +
                "\nYou can NOT commit in detached HEAD state, but you can always create a new branch.");
        }
    }
开发者ID:ssyp-ru,项目名称:ssyp16-ws13,代码行数:28,代码来源:cli.ts

示例4: log

	connection.on('misskey.log', (data: any) => {
		const date = data.date;
		const method = data.method;
		const host = data.host;
		const path = data.path;
		const ua = data.ua;
		const ip = data.ip;
		const worker = data.worker;

		/* tslint:disable max-line-length */
		log(`${colors.gray(date)} ${method} ${colors.cyan(host)} ${colors.bold(path)} ${ua} ${colors.green(ip)} ${colors.gray('(' + worker + ')')}`);
		/* tslint:enable max-line-length */
	});
开发者ID:syuilo,项目名称:misskey-web-logger,代码行数:13,代码来源:cli.ts

示例5: report

    async report(testCase: TestSuiteConfig, result: RegressionResultSet): Promise<void> {
        console.log(Array(80).join('='));
        console.log(c.bold(`== ${testCase.testSuite} ==`));

        if (result.hasErrors) {
            console.log('Errors:');
            for (const error of result.errors) {
                console.log(`  Error occured for '${error.testCase.targetUrl}': ${error.errorMessages.join(' # ')}`);
            }
        }

        if (result.hasViolations) {
            console.log('Violations:');
            for (const violation of result.violations) {
                console.log(`  Assertion violated for '${violation.testCase.targetUrl}': ${violation.violationMessages.join(' # ')}`);
            }
        }

        // fixme: details
        // if (result.hasErrors || result.hasViolations) {
        //     console.log(c.bold(`Details:`));
        //     for (const error of result.errors) {
        //         console.log(`  [${error.errorCode}] ${error.affectedUrl.url} with error message: ${error.errorMessage}`);
        //     }
        //     for (const violation of result.violations) {
        //         console.log(`  [${violation.statusCode}] ${violation.affectedUrl.url}`
        //             + ((violation.hasError) ? ` with error message: ${violation.errorMessage}` : ''));
        //     }
        // }


        // summary statistics
        console.log(c.bold(`Summary:`));
        console.log(`  Errors: ${result.errors.length}`);
        console.log(`  Violations: ${result.violations.length}`);
        console.log(`  Passed: ${result.passed.length}`);
        console.log(Array(80).join('='));
    }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例6: fetch

    export function fetch(options: any) {
        if (!!options.quiet) log.silence();
        let repo = cwdRepo();

        let url = conf.get('repo_' + repo.name + '.url');
        if (!url) {
            log.error(`remote address not specified. Use ${colors.bold('jerk config set this.url <url>')} to set remote address to ${colors.italic('<url>')}`);
            return;
        }

        Client.fetch(repo, url, progressBarCallback(), (success) => {
            if (success) {
                log.success('fetch finished successfully');
            } else {
                log.error('fetch failed');
            }
        });
    }
开发者ID:ssyp-ru,项目名称:ssyp16-ws13,代码行数:18,代码来源:cli.ts

示例7: pull

    export function pull(options: any) {
        if (!!options.quiet) log.silence();
        let repo = cwdRepo();

        let url = conf.get('repo_' + repo.name + '.url');
        if (!url) {
            log.error(`remote address not specified. Use ${colors.bold('jerk config set this.url <url>')} to set remote address to ${colors.italic('<url>')}`);
            return;
        }

        let remote = parseRemoteAddress(url);

        let bar = new ProgressBar('  remote [:bar] :percent :etas', { total: 100, clear: true });

        let cp = child_process.spawn("rsync",
            [`rsync://${remote.host}:${remote.port}/jerk/objects`, '--info=progress2',
                '-E', '-hhh', '-r', '-u', '--delete-delay', '.jerk']);
        cp.stdout.on('data', (stdout) => {
            rsyncOutputProgressUpdate(stdout, bar);
        });
        let cpInterval = setInterval(() => bar.tick(0), 100);

        fetchConfig(url, (cfg) => {
            Common.iterateStringKeyObject<string[]>(cfg.refs).forEach(v => {
                let ref = repo.ref(v.key);
                let val = v.value;
                if (ref) {
                    ref.name = val[1];
                    ref.head = val[2];
                    ref.time = parseInt(val[3]);
                } else {
                    repo.addRef(new Common.Ref(val[2], val[1], repo, parseInt(val[3])));
                }
            });

            cp.on('exit', (code: number, signal: string) => {
                bar.tick(100);
                clearInterval(cpInterval);
                log.success('pull finished successfully');
            });
        });
    }
开发者ID:STALKER2010,项目名称:jerk,代码行数:42,代码来源:cli.ts

示例8: push

    export function push(options: any) {
        if (!!options.quiet) log.silence();
        let repo = cwdRepo();

        let url = conf.get('repo_' + repo.name + '.url');
        if (!url) {
            log.error(`remote address not specified. Use ${colors.bold('jerk config set this.url <url>')} to set remote address to ${colors.italic('<url>')}`);
            return;
        }

        var mode = conf.get('repo_' + repo.name + '.mode');
        if (!mode) mode = 'rsync';
        if (mode !== 'rsync' && mode !== 'http') {
            log.error(`unknown connection mode. Supported modes are: ${colors.italic('rsync')} and ${colors.italic('http')}`);
            return;
        }

        Client.push(repo, url, mode, () => {
            log.error('cannot push to remote server, pull remote changes and try again.');
        }, progressBarCallback(), (res: Client.PushSuccessState) => {
            switch (res) {
                case Client.PushSuccessState.UP_TO_DATE:
                    log.success('up-to-date!');
                    break;
                case Client.PushSuccessState.CONNECTION_FAILED:
                    log.error('connection to remote failed!');
                    break;
                case Client.PushSuccessState.OK:
                    log.success('push finished successfully!');
                    break;
                case Client.PushSuccessState.FAIL:
                default:
                    log.error('error occured while pushing to remote!');
                    break;
            }
        });
    }
开发者ID:ssyp-ru,项目名称:ssyp16-ws13,代码行数:37,代码来源:cli.ts

示例9: push

    export function push(options: any) {
        if (!!options.quiet) log.silence();
        let repo = cwdRepo();

        let url = conf.get('repo_' + repo.name + '.url');
        if (!url) {
            log.error(`remote address not specified. Use ${colors.bold('jerk config set this.url <url>')} to set remote address to ${colors.italic('<url>')}`);
            return;
        }

        var mode = conf.get('repo_' + repo.name + '.mode');
        if (!mode) mode = 'rsync';
        if (mode !== 'rsync' && mode !== 'http') {
            log.error(`unknown connection mode. Supported modes are: ${colors.italic('rsync')} and ${colors.italic('http')}`);
            return;
        }

        fetchConfig(url, (cfg) => {
            cfg = JSON.parse(cfg);
            let data = fastForwardable(repo, cfg);
            if (!data) return;

            let newCommits = repo.commits
                .map(x => (data.remoteCommits.indexOf(x.id) < 0) ? x : null)
                .filter(x => !!x)
                .map(x => x.data());
            let newRefs = repo.refs()
                .map(x => (data.remoteRefs.indexOf(x.name) < 0 && x.name !== 'HEAD') ? x : null)
                .filter(x => !!x)
                .map(x => x.data());
            let changedRefs = data.changedRefs
                .map(x => repo.ref(x).data());

            if (newCommits.length === 0 && newRefs.length === 0 && changedRefs.length === 0) {
                return log.success('up-to-date!');
            }

            let refs = {};
            let commits = {};
            newRefs.concat(changedRefs).forEach(x => refs[x[1]] = x);
            newCommits.forEach(x => commits[x[1]] = x);

            let json = {
                refs: refs,
                commits: commits,
                revision: cfg.revision
            }

            let remote = parseRemoteAddress(url);

            let jsonPush = JSON.stringify(json);

            pushJSON(remote, jsonPush, (res) => {
                if (!res) {
                    log.error('push connection failed');
                    return;
                }
                if (res === 'OK') {
                    uploadObjects(remote, mode, (res) => {
                        if (res) return log.success('push finished successfully!');
                        return log.error('uploading objects failed');
                    });
                    return;
                }
                log.error('remote:', res);
            });
        });
    }
开发者ID:STALKER2010,项目名称:jerk,代码行数:68,代码来源:cli.ts

示例10: require

import * as fse from 'fs-extra';
import * as path from 'path';
import * as Common from './common';
import * as Format from './format';
import * as Client from './client';
import * as Logger from './log';
import program = require('commander');
import * as glob from 'glob';
import * as Moment from 'moment';
import Configstore = require('configstore');
let ProgressBar = require('progress');

let conf = new Configstore('jerk');

let commitConfigOptionDescription = 'Create new commit based on previously written out old commit' +
    ` (e.g. with ${colors.bold('pull')}, ${colors.bold('merge')} ` +
    `or ${colors.bold('reset')} commands).`;
let resetCommitGivenHint = "You have specified commit to reset given index entries to. In JERK, index" +
    ` entries do NOT relate to any commit, instead use "${colors.bold('jerk checkout')}` +
    " command to load file contents from the specified commit. Option ignored.";
let quietDescription = 'Be quiet, only print warnings and errors, any other output will be suppressed.';

module CLI {
    export let log = new Logger.Logger();

    let rsyncPercentage = /\s+(\d+)%/;
    function rsyncOutputProgressUpdate(stdout: any, bar: any) {
        let s = stdout.toString().trim().split('\r').pop();
        if (rsyncPercentage.test(s)) {
            let perc = parseInt(rsyncPercentage.exec(s)[1]);
            return bar.update(perc / 100);
开发者ID:STALKER2010,项目名称:jerk,代码行数:31,代码来源:cli.ts


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