mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-16 15:23:47 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
97
node_modules/ora/index.js
generated
vendored
Normal file
97
node_modules/ora/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
'use strict';
|
||||
var chalk = require('chalk');
|
||||
var cliCursor = require('cli-cursor');
|
||||
var cliSpinners = require('cli-spinners');
|
||||
var objectAssign = require('object-assign');
|
||||
|
||||
function Ora(options) {
|
||||
if (!(this instanceof Ora)) {
|
||||
return new Ora(options);
|
||||
}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
this.options = objectAssign({
|
||||
text: '',
|
||||
color: 'cyan',
|
||||
stream: process.stderr
|
||||
}, options);
|
||||
|
||||
var sp = this.options.spinner;
|
||||
this.spinner = typeof sp === 'object' ? sp : (process.platform === 'win32' ? cliSpinners.line : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Ora.prototype.frame = function () {
|
||||
var frames = this.spinner.frames;
|
||||
var frame = frames[this.frameIndex];
|
||||
|
||||
if (this.color) {
|
||||
frame = chalk[this.color](frame);
|
||||
}
|
||||
|
||||
this.frameIndex = ++this.frameIndex % frames.length;
|
||||
|
||||
return frame + ' ' + this.text;
|
||||
};
|
||||
|
||||
Ora.prototype.clear = function () {
|
||||
if (!this.enabled) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.stream.clearLine();
|
||||
this.stream.cursorTo(0);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Ora.prototype.render = function () {
|
||||
this.clear();
|
||||
this.stream.write(this.frame());
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Ora.prototype.start = function () {
|
||||
if (!this.enabled || this.id) {
|
||||
return this;
|
||||
}
|
||||
|
||||
cliCursor.hide();
|
||||
this.render();
|
||||
this.id = setInterval(this.render.bind(this), this.interval);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Ora.prototype.stop = function () {
|
||||
if (!this.enabled) {
|
||||
return this;
|
||||
}
|
||||
|
||||
clearInterval(this.id);
|
||||
this.id = null;
|
||||
this.frameIndex = 0;
|
||||
this.clear();
|
||||
cliCursor.show();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = Ora;
|
||||
21
node_modules/ora/license
generated
vendored
Normal file
21
node_modules/ora/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
48
node_modules/ora/package.json
generated
vendored
Normal file
48
node_modules/ora/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "ora",
|
||||
"version": "0.2.3",
|
||||
"description": "Elegant terminal spinner",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/ora",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"spinner",
|
||||
"spinners",
|
||||
"terminal",
|
||||
"term",
|
||||
"console",
|
||||
"ascii",
|
||||
"unicode",
|
||||
"loading",
|
||||
"indicator",
|
||||
"progress",
|
||||
"busy",
|
||||
"wait",
|
||||
"idle"
|
||||
],
|
||||
"dependencies": {
|
||||
"chalk": "^1.1.1",
|
||||
"cli-cursor": "^1.0.2",
|
||||
"cli-spinners": "^0.1.2",
|
||||
"object-assign": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"hook-std": "^0.2.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
134
node_modules/ora/readme.md
generated
vendored
Normal file
134
node_modules/ora/readme.md
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# ora [](https://travis-ci.org/sindresorhus/ora)
|
||||
|
||||
> Elegant terminal spinner
|
||||
|
||||
<img src="screenshot.gif" width="629">
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save ora
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ora = require('ora');
|
||||
|
||||
const spinner = ora('Loading unicorns').start();
|
||||
|
||||
setTimeout(() => {
|
||||
spinner.color = 'yellow';
|
||||
spinner.text = 'Loading rainbows';
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
It will gracefully not do anything when there's no TTY or when in a CI.
|
||||
|
||||
### ora([options|text])
|
||||
|
||||
If a string is provided, it is treated as a shortcut for [`options.text`](#text).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### text
|
||||
|
||||
Type: `string`
|
||||
|
||||
Text to display after the spinner.
|
||||
|
||||
##### spinner
|
||||
|
||||
Type: `string` `object`<br>
|
||||
Default: `dots` <img src="screenshot-spinner.gif" width="14">
|
||||
|
||||
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners.
|
||||
|
||||
Or an object like:
|
||||
|
||||
```js
|
||||
{
|
||||
interval: 80, // optional
|
||||
frames: ['-', '+', '-']
|
||||
}
|
||||
```
|
||||
|
||||
##### color
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `cyan`<br>
|
||||
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`
|
||||
|
||||
Color of the spinner.
|
||||
|
||||
##### interval
|
||||
|
||||
Type: `number`<br>
|
||||
Default: Provided by the spinner or `100`
|
||||
|
||||
Interval between each frame.
|
||||
|
||||
Spinners provide their own recommended interval, so you don't really need to specify this.
|
||||
|
||||
##### stream
|
||||
|
||||
Type: `WritableStream`<br>
|
||||
Default: `process.stderr`
|
||||
|
||||
Stream to write the output.
|
||||
|
||||
You could for example set this to `process.stdout` instead.
|
||||
|
||||
##### enabled
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Force enabling of the spinner regardless of the `stream` not being run inside a TTY context and/or in a CI environment.
|
||||
|
||||
### Instance
|
||||
|
||||
#### .start()
|
||||
|
||||
Start the spinner. Returns the instance.
|
||||
|
||||
#### .stop()
|
||||
|
||||
Stop and clear the spinner. Returns the instance.
|
||||
|
||||
#### .clear()
|
||||
|
||||
Clear the spinner. Returns the instance.
|
||||
|
||||
#### .render()
|
||||
|
||||
Manually render a new frame. Returns the instance.
|
||||
|
||||
#### .frame()
|
||||
|
||||
Get a new frame.
|
||||
|
||||
#### .text
|
||||
|
||||
Change the text.
|
||||
|
||||
#### .color
|
||||
|
||||
Change the spinner color.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user