How to use the cli-spinners.line function in cli-spinners

To help you get started, we’ve selected a few cli-spinners examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github YMFE / ykit / lib / utils / ora.js View on Github external
(0, _classCallCheck3.default)(this, Ora);

        if (typeof options === 'string') {
            options = {
                text: options
            };
        }

        this.options = extend(true, {
            text: '',
            color: 'cyan',
            stream: process.stderr
        }, options);

        var sp = this.options.spinner;
        this.spinner = (typeof sp === 'undefined' ? 'undefined' : (0, _typeof3.default)(sp)) === 'object' ? sp : process.platform === 'win32' ? cliSpinners.line : cliSpinners[sp] || cliSpinners.dots; // eslint-disable-line no-nested-ternary

        if (this.spinner.frames === undefined) {
            throw new Error('Spinner must define `frames`');
        }

        this.text = this.options.text;
        this.color = this.options.color;
        this.interval = this.options.interval || this.spinner.interval || 100;
        this.stream = this.options.stream;
        this.id = null;
        this.frameIndex = 0;
        this.enabled = this.options.enabled || this.stream && this.stream.isTTY && !process.env.CI;
    }
github YMFE / ykit / src / utils / ora.js View on Github external
options = {
                text: options
            };
        }

        this.options = extend(true, {
            text: '',
            color: 'cyan',
            stream: process.stderr
        }, options);

        const sp = this.options.spinner;
        this.spinner = typeof sp === 'object'
            ? sp
            : (process.platform === 'win32'
                ? cliSpinners.line
                : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line no-nested-ternary

        if (this.spinner.frames === undefined) {
            throw new Error('Spinner must define `frames`');
        }

        this.text = this.options.text;
        this.color = this.options.color;
        this.interval = this.options.interval || this.spinner.interval || 100;
        this.stream = this.options.stream;
        this.id = null;
        this.frameIndex = 0;
        this.enabled = this.options.enabled || ((this.stream && this.stream.isTTY) && !process.env.CI);
    }
    frame() {
github sindresorhus / ora / index.js View on Github external
set spinner(spinner) {
		this.frameIndex = 0;

		if (typeof spinner === 'object') {
			if (spinner.frames === undefined) {
				throw new Error('The given spinner must have a `frames` property');
			}

			this._spinner = spinner;
		} else if (process.platform === 'win32') {
			this._spinner = cliSpinners.line;
		} else if (spinner === undefined) {
			// Set default spinner
			this._spinner = cliSpinners.dots;
		} else if (cliSpinners[spinner]) {
			this._spinner = cliSpinners[spinner];
		} else {
			throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`);
		}

		this._updateInterval(this._spinner.interval);
	}
github TryGhost / Ghost-CLI / lib / ui / spinner.js View on Github external
Spinner = function Spinner(options) {
    options = assign({
        color: 'green',
        text: '',
        stream: process.stderr
    }, options || {});

    this.text = options.text;
    this.color = options.color;
    this.spinner = (process.platform === 'win32') ? spinners.line :
        (spinners[options.spinner] || spinners.hamburger);

    this.interval = this.spinner.interval || 100;
    this.stream = options.stream;
    this.id = null;
    this.frameIndex = 0;
    this.enabled = options.enabled || ((this.stream && this.stream.isTTY) && !process.env.CI);
};