init
This commit is contained in:
51
node_modules/cli-table/History.md
generated
vendored
Normal file
51
node_modules/cli-table/History.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
0.3.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* fix example for new paths
|
||||
* Readme badges
|
||||
* Lighter production installs
|
||||
* Safe colors
|
||||
* In addition to 256-xterm ansi colors, handle 24-bit colors
|
||||
* set up .travis.yml
|
||||
|
||||
0.3.0 / 2014-02-02
|
||||
==================
|
||||
|
||||
* Switch version of colors to avoid npm broken-ness
|
||||
* Handle custom colored strings correctly
|
||||
* Removing var completely as return var width caused other problems.
|
||||
* Fixing global leak of width variable.
|
||||
* Omit horizontal decoration lines if empty
|
||||
* Add a test for the the compact mode
|
||||
* Make line() return the generated string instead of appending it to ret
|
||||
* Customize the vertical cell separator separately from the right one
|
||||
* Allow newer versions of colors to be used
|
||||
* Added test for bordercolor
|
||||
* Add bordercolor in style options and enable deepcopy of options
|
||||
|
||||
0.2.0 / 2012-10-21
|
||||
==================
|
||||
|
||||
* test: avoid module dep in tests
|
||||
* fix type bug on integer vertical table value
|
||||
* handle newlines in vertical and cross tables
|
||||
* factor out common style setting function
|
||||
* handle newlines in body cells
|
||||
* fix render bug when no header provided
|
||||
* correctly calculate width of cells with newlines
|
||||
* handles newlines in header cells
|
||||
* ability to create cross tables
|
||||
* changing table chars to ones that windows supports
|
||||
* allow empty arguments to Table constructor
|
||||
* fix headless tables containing empty first row
|
||||
* add vertical tables
|
||||
* remove reference to require.paths
|
||||
* compact style for dense tables
|
||||
* fix toString without col widths by cloning array
|
||||
* [api]: Added abiltity to strip out ANSI color escape codes when calculating cell padding
|
||||
|
||||
0.0.1 / 2011-01-03
|
||||
==================
|
||||
|
||||
Initial release
|
179
node_modules/cli-table/README.md
generated
vendored
Normal file
179
node_modules/cli-table/README.md
generated
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
CLI Table [](http://badge.fury.io/js/cli-table) [](http://travis-ci.org/Automattic/cli-table)
|
||||
=========
|
||||
|
||||
This utility allows you to render unicode-aided tables on the command line from
|
||||
your node.js scripts.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- Customizable characters that constitute the table.
|
||||
- Color/background styling in the header through
|
||||
[colors.js](http://github.com/marak/colors.js)
|
||||
- Column width customization
|
||||
- Text truncation based on predefined widths
|
||||
- Text alignment (left, right, center)
|
||||
- Padding (left, right)
|
||||
- Easy-to-use API
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install cli-table
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
### Horizontal Tables
|
||||
```javascript
|
||||
var Table = require('cli-table');
|
||||
|
||||
// instantiate
|
||||
var table = new Table({
|
||||
head: ['TH 1 label', 'TH 2 label']
|
||||
, colWidths: [100, 200]
|
||||
});
|
||||
|
||||
// table is an Array, so you can `push`, `unshift`, `splice` and friends
|
||||
table.push(
|
||||
['First value', 'Second value']
|
||||
, ['First value', 'Second value']
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
```
|
||||
|
||||
### Vertical Tables
|
||||
```javascript
|
||||
var Table = require('cli-table');
|
||||
var table = new Table();
|
||||
|
||||
table.push(
|
||||
{ 'Some key': 'Some value' }
|
||||
, { 'Another key': 'Another value' }
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
```
|
||||
### Cross Tables
|
||||
Cross tables are very similar to vertical tables, with two key differences:
|
||||
|
||||
1. They require a `head` setting when instantiated that has an empty string as the first header
|
||||
2. The individual rows take the general form of { "Header": ["Row", "Values"] }
|
||||
|
||||
```javascript
|
||||
var Table = require('cli-table');
|
||||
var table = new Table({ head: ["", "Top Header 1", "Top Header 2"] });
|
||||
|
||||
table.push(
|
||||
{ 'Left Header 1': ['Value Row 1 Col 1', 'Value Row 1 Col 2'] }
|
||||
, { 'Left Header 2': ['Value Row 2 Col 1', 'Value Row 2 Col 2'] }
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
```
|
||||
|
||||
### Custom styles
|
||||
The ```chars``` property controls how the table is drawn:
|
||||
```javascript
|
||||
var table = new Table({
|
||||
chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'
|
||||
, 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝'
|
||||
, 'left': '║' , 'left-mid': '╟' , 'mid': '─' , 'mid-mid': '┼'
|
||||
, 'right': '║' , 'right-mid': '╢' , 'middle': '│' }
|
||||
});
|
||||
|
||||
table.push(
|
||||
['foo', 'bar', 'baz']
|
||||
, ['frob', 'bar', 'quuz']
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
// Outputs:
|
||||
//
|
||||
//╔══════╤═════╤══════╗
|
||||
//║ foo │ bar │ baz ║
|
||||
//╟──────┼─────┼──────╢
|
||||
//║ frob │ bar │ quuz ║
|
||||
//╚══════╧═════╧══════╝
|
||||
```
|
||||
|
||||
Empty decoration lines will be skipped, to avoid vertical separator rows just
|
||||
set the 'mid', 'left-mid', 'mid-mid', 'right-mid' to the empty string:
|
||||
```javascript
|
||||
var table = new Table({ chars: {'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': ''} });
|
||||
table.push(
|
||||
['foo', 'bar', 'baz']
|
||||
, ['frobnicate', 'bar', 'quuz']
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
// Outputs: (note the lack of the horizontal line between rows)
|
||||
//┌────────────┬─────┬──────┐
|
||||
//│ foo │ bar │ baz │
|
||||
//│ frobnicate │ bar │ quuz │
|
||||
//└────────────┴─────┴──────┘
|
||||
```
|
||||
|
||||
By setting all chars to empty with the exception of 'middle' being set to a
|
||||
single space and by setting padding to zero, it's possible to get the most
|
||||
compact layout with no decorations:
|
||||
```javascript
|
||||
var table = new Table({
|
||||
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
|
||||
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
|
||||
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
|
||||
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
|
||||
style: { 'padding-left': 0, 'padding-right': 0 }
|
||||
});
|
||||
|
||||
table.push(
|
||||
['foo', 'bar', 'baz']
|
||||
, ['frobnicate', 'bar', 'quuz']
|
||||
);
|
||||
|
||||
console.log(table.toString());
|
||||
// Outputs:
|
||||
//foo bar baz
|
||||
//frobnicate bar quuz
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
Clone the repository with all its submodules and run:
|
||||
|
||||
```bash
|
||||
$ make test
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
- Guillermo Rauch <guillermo@learnboost.com> ([Guille](http://github.com/guille))
|
||||
|
||||
[](https://huntr.dev)
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010 LearnBoost <dev@learnboost.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.
|
298
node_modules/cli-table/lib/index.js
generated
vendored
Normal file
298
node_modules/cli-table/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var colors = require('colors/safe')
|
||||
, utils = require('./utils')
|
||||
, repeat = utils.repeat
|
||||
, truncate = utils.truncate
|
||||
, pad = utils.pad;
|
||||
|
||||
/**
|
||||
* Table constructor
|
||||
*
|
||||
* @param {Object} options
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Table (options){
|
||||
this.options = utils.options({
|
||||
chars: {
|
||||
'top': '─'
|
||||
, 'top-mid': '┬'
|
||||
, 'top-left': '┌'
|
||||
, 'top-right': '┐'
|
||||
, 'bottom': '─'
|
||||
, 'bottom-mid': '┴'
|
||||
, 'bottom-left': '└'
|
||||
, 'bottom-right': '┘'
|
||||
, 'left': '│'
|
||||
, 'left-mid': '├'
|
||||
, 'mid': '─'
|
||||
, 'mid-mid': '┼'
|
||||
, 'right': '│'
|
||||
, 'right-mid': '┤'
|
||||
, 'middle': '│'
|
||||
}
|
||||
, truncate: '…'
|
||||
, colWidths: []
|
||||
, colAligns: []
|
||||
, style: {
|
||||
'padding-left': 1
|
||||
, 'padding-right': 1
|
||||
, head: ['red']
|
||||
, border: ['grey']
|
||||
, compact : false
|
||||
}
|
||||
, head: []
|
||||
}, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Inherit from Array.
|
||||
*/
|
||||
|
||||
Table.prototype.__proto__ = Array.prototype;
|
||||
|
||||
/**
|
||||
* Width getter
|
||||
*
|
||||
* @return {Number} width
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Table.prototype.__defineGetter__('width', function (){
|
||||
var str = this.toString().split("\n");
|
||||
if (str.length) return str[0].length;
|
||||
return 0;
|
||||
});
|
||||
|
||||
/**
|
||||
* Render to a string.
|
||||
*
|
||||
* @return {String} table representation
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Table.prototype.render
|
||||
Table.prototype.toString = function (){
|
||||
var ret = ''
|
||||
, options = this.options
|
||||
, style = options.style
|
||||
, head = options.head
|
||||
, chars = options.chars
|
||||
, truncater = options.truncate
|
||||
, colWidths = options.colWidths || new Array(this.head.length)
|
||||
, totalWidth = 0;
|
||||
|
||||
if (!head.length && !this.length) return '';
|
||||
|
||||
if (!colWidths.length){
|
||||
var all_rows = this.slice(0);
|
||||
if (head.length) { all_rows = all_rows.concat([head]) };
|
||||
|
||||
all_rows.forEach(function(cells){
|
||||
// horizontal (arrays)
|
||||
if (typeof cells === 'object' && cells.length) {
|
||||
extractColumnWidths(cells);
|
||||
|
||||
// vertical (objects)
|
||||
} else {
|
||||
var header_cell = Object.keys(cells)[0]
|
||||
, value_cell = cells[header_cell];
|
||||
|
||||
colWidths[0] = Math.max(colWidths[0] || 0, get_width(header_cell) || 0);
|
||||
|
||||
// cross (objects w/ array values)
|
||||
if (typeof value_cell === 'object' && value_cell.length) {
|
||||
extractColumnWidths(value_cell, 1);
|
||||
} else {
|
||||
colWidths[1] = Math.max(colWidths[1] || 0, get_width(value_cell) || 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
totalWidth = (colWidths.length == 1 ? colWidths[0] : colWidths.reduce(
|
||||
function (a, b){
|
||||
return a + b
|
||||
})) + colWidths.length + 1;
|
||||
|
||||
function extractColumnWidths(arr, offset) {
|
||||
var offset = offset || 0;
|
||||
arr.forEach(function(cell, i){
|
||||
colWidths[i + offset] = Math.max(colWidths[i + offset] || 0, get_width(cell) || 0);
|
||||
});
|
||||
};
|
||||
|
||||
function get_width(obj) {
|
||||
return typeof obj == 'object' && obj.width != undefined
|
||||
? obj.width
|
||||
: ((typeof obj == 'object' ? utils.strlen(obj.text) : utils.strlen(obj)) + (style['padding-left'] || 0) + (style['padding-right'] || 0))
|
||||
}
|
||||
|
||||
// draws a line
|
||||
function line (line, left, right, intersection){
|
||||
var width = 0
|
||||
, line =
|
||||
left
|
||||
+ repeat(line, totalWidth - 2)
|
||||
+ right;
|
||||
|
||||
colWidths.forEach(function (w, i){
|
||||
if (i == colWidths.length - 1) return;
|
||||
width += w + 1;
|
||||
line = line.substr(0, width) + intersection + line.substr(width + 1);
|
||||
});
|
||||
|
||||
return applyStyles(options.style.border, line);
|
||||
};
|
||||
|
||||
// draws the top line
|
||||
function lineTop (){
|
||||
var l = line(chars.top
|
||||
, chars['top-left'] || chars.top
|
||||
, chars['top-right'] || chars.top
|
||||
, chars['top-mid']);
|
||||
if (l)
|
||||
ret += l + "\n";
|
||||
};
|
||||
|
||||
function generateRow (items, style) {
|
||||
var cells = []
|
||||
, max_height = 0;
|
||||
|
||||
// prepare vertical and cross table data
|
||||
if (!Array.isArray(items) && typeof items === "object") {
|
||||
var key = Object.keys(items)[0]
|
||||
, value = items[key]
|
||||
, first_cell_head = true;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
items = value;
|
||||
items.unshift(key);
|
||||
} else {
|
||||
items = [key, value];
|
||||
}
|
||||
}
|
||||
|
||||
// transform array of item strings into structure of cells
|
||||
items.forEach(function (item, i) {
|
||||
var contents = item.toString().split("\n").reduce(function (memo, l) {
|
||||
memo.push(string(l, i));
|
||||
return memo;
|
||||
}, [])
|
||||
|
||||
var height = contents.length;
|
||||
if (height > max_height) { max_height = height };
|
||||
|
||||
cells.push({ contents: contents , height: height });
|
||||
});
|
||||
|
||||
// transform vertical cells into horizontal lines
|
||||
var lines = new Array(max_height);
|
||||
cells.forEach(function (cell, i) {
|
||||
cell.contents.forEach(function (line, j) {
|
||||
if (!lines[j]) { lines[j] = [] };
|
||||
if (style || (first_cell_head && i === 0 && options.style.head)) {
|
||||
line = applyStyles(options.style.head, line)
|
||||
}
|
||||
|
||||
lines[j].push(line);
|
||||
});
|
||||
|
||||
// populate empty lines in cell
|
||||
for (var j = cell.height, l = max_height; j < l; j++) {
|
||||
if (!lines[j]) { lines[j] = [] };
|
||||
lines[j].push(string('', i));
|
||||
}
|
||||
});
|
||||
var ret = "";
|
||||
lines.forEach(function (line, index) {
|
||||
if (ret.length > 0) {
|
||||
ret += "\n" + applyStyles(options.style.border, chars.left);
|
||||
}
|
||||
|
||||
ret += line.join(applyStyles(options.style.border, chars.middle)) + applyStyles(options.style.border, chars.right);
|
||||
});
|
||||
|
||||
return applyStyles(options.style.border, chars.left) + ret;
|
||||
};
|
||||
|
||||
function applyStyles(styles, subject) {
|
||||
if (!subject)
|
||||
return '';
|
||||
styles.forEach(function(style) {
|
||||
subject = colors[style](subject);
|
||||
});
|
||||
return subject;
|
||||
};
|
||||
|
||||
// renders a string, by padding it or truncating it
|
||||
function string (str, index){
|
||||
var str = String(typeof str == 'object' && str.text ? str.text : str)
|
||||
, length = utils.strlen(str)
|
||||
, width = colWidths[index]
|
||||
- (style['padding-left'] || 0)
|
||||
- (style['padding-right'] || 0)
|
||||
, align = options.colAligns[index] || 'left';
|
||||
|
||||
return repeat(' ', style['padding-left'] || 0)
|
||||
+ (length == width ? str :
|
||||
(length < width
|
||||
? pad(str, ( width + (str.length - length) ), ' ', align == 'left' ? 'right' :
|
||||
(align == 'middle' ? 'both' : 'left'))
|
||||
: (truncater ? truncate(str, width, truncater) : str))
|
||||
)
|
||||
+ repeat(' ', style['padding-right'] || 0);
|
||||
};
|
||||
|
||||
if (head.length){
|
||||
lineTop();
|
||||
|
||||
ret += generateRow(head, style.head) + "\n"
|
||||
}
|
||||
|
||||
if (this.length)
|
||||
this.forEach(function (cells, i){
|
||||
if (!head.length && i == 0)
|
||||
lineTop();
|
||||
else {
|
||||
if (!style.compact || i<(!!head.length) ?1:0 || cells.length == 0){
|
||||
var l = line(chars.mid
|
||||
, chars['left-mid']
|
||||
, chars['right-mid']
|
||||
, chars['mid-mid']);
|
||||
if (l)
|
||||
ret += l + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
if (cells.hasOwnProperty("length") && !cells.length) {
|
||||
return
|
||||
} else {
|
||||
ret += generateRow(cells) + "\n";
|
||||
};
|
||||
});
|
||||
|
||||
var l = line(chars.bottom
|
||||
, chars['bottom-left'] || chars.bottom
|
||||
, chars['bottom-right'] || chars.bottom
|
||||
, chars['bottom-mid']);
|
||||
if (l)
|
||||
ret += l;
|
||||
else
|
||||
// trim the last '\n' if we didn't add the bottom decoration
|
||||
ret = ret.slice(0, -1);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = Table;
|
||||
|
||||
module.exports.version = '0.0.1';
|
87
node_modules/cli-table/lib/utils.js
generated
vendored
Normal file
87
node_modules/cli-table/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
/**
|
||||
* Repeats a string.
|
||||
*
|
||||
* @param {String} char(s)
|
||||
* @param {Number} number of times
|
||||
* @return {String} repeated string
|
||||
*/
|
||||
|
||||
exports.repeat = function (str, times){
|
||||
return Array(times + 1).join(str);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pads a string
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.pad = function (str, len, pad, dir) {
|
||||
if (len + 1 >= str.length)
|
||||
switch (dir){
|
||||
case 'left':
|
||||
str = Array(len + 1 - str.length).join(pad) + str;
|
||||
break;
|
||||
|
||||
case 'both':
|
||||
var right = Math.ceil((padlen = len - str.length) / 2);
|
||||
var left = padlen - right;
|
||||
str = Array(left + 1).join(pad) + str + Array(right + 1).join(pad);
|
||||
break;
|
||||
|
||||
default:
|
||||
str = str + Array(len + 1 - str.length).join(pad);
|
||||
};
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Truncates a string
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports.truncate = function (str, length, chr){
|
||||
chr = chr || '…';
|
||||
return str.length >= length ? str.substr(0, length - chr.length) + chr : str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Copies and merges options with defaults.
|
||||
*
|
||||
* @param {Object} defaults
|
||||
* @param {Object} supplied options
|
||||
* @return {Object} new (merged) object
|
||||
*/
|
||||
|
||||
function options(defaults, opts) {
|
||||
for (var p in opts) {
|
||||
if (p === '__proto__' || p === 'constructor' || p === 'prototype') {
|
||||
continue;
|
||||
}
|
||||
if (opts[p] && opts[p].constructor && opts[p].constructor === Object) {
|
||||
defaults[p] = defaults[p] || {};
|
||||
options(defaults[p], opts[p]);
|
||||
} else {
|
||||
defaults[p] = opts[p];
|
||||
}
|
||||
}
|
||||
return defaults;
|
||||
};
|
||||
exports.options = options;
|
||||
|
||||
//
|
||||
// For consideration of terminal "color" programs like colors.js,
|
||||
// which can add ANSI escape color codes to strings,
|
||||
// we destyle the ANSI color escape codes for padding calculations.
|
||||
//
|
||||
// see: http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
//
|
||||
exports.strlen = function(str){
|
||||
var code = /\u001b\[(?:\d*;){0,5}\d*m/g;
|
||||
var stripped = ("" + str).replace(code,'');
|
||||
var split = stripped.split("\n");
|
||||
return split.reduce(function (memo, s) { return (s.length > memo) ? s.length : memo }, 0);
|
||||
}
|
6
node_modules/cli-table/node_modules/colors/.travis.yml
generated
vendored
Normal file
6
node_modules/cli-table/node_modules/colors/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
- "0.6"
|
23
node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
23
node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional Functionality
|
||||
- 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.
|
167
node_modules/cli-table/node_modules/colors/ReadMe.md
generated
vendored
Normal file
167
node_modules/cli-table/node_modules/colors/ReadMe.md
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
# colors.js
|
||||
|
||||
## get color and style in your node.js console
|
||||
|
||||
<img src="https://github.com/Marak/colors.js/raw/master/screenshots/colors.png"/>
|
||||
|
||||
## Installation
|
||||
|
||||
npm install colors
|
||||
|
||||
## colors and styles!
|
||||
|
||||
### text colors
|
||||
|
||||
- black
|
||||
- red
|
||||
- green
|
||||
- yellow
|
||||
- blue
|
||||
- magenta
|
||||
- cyan
|
||||
- white
|
||||
- gray
|
||||
- grey
|
||||
|
||||
### background colors
|
||||
|
||||
|
||||
|
||||
- bgBlack
|
||||
- bgRed
|
||||
- bgGreen
|
||||
- bgYellow
|
||||
- bgBlue
|
||||
- bgMagenta
|
||||
- bgCyan
|
||||
- bgWhite
|
||||
|
||||
### styles
|
||||
|
||||
- reset
|
||||
- bold
|
||||
- dim
|
||||
- italic
|
||||
- underline
|
||||
- inverse
|
||||
- hidden
|
||||
- strikethrough
|
||||
|
||||
### extras
|
||||
|
||||
- rainbow
|
||||
- zebra
|
||||
- america
|
||||
- trap
|
||||
- random
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
By popular demand, `colors` now ships with two types of usages!
|
||||
|
||||
The super nifty way
|
||||
|
||||
```js
|
||||
var colors = require('colors');
|
||||
|
||||
console.log('hello'.green); // outputs green text
|
||||
console.log('i like cake and pies'.underline.red) // outputs red underlined text
|
||||
console.log('inverse the color'.inverse); // inverses the color
|
||||
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||
console.log('Run the trap'.trap); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
console.log(colors.green('hello')); // outputs green text
|
||||
console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
|
||||
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||
|
||||
```
|
||||
|
||||
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||
|
||||
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
||||
|
||||
## Disabling Colors
|
||||
|
||||
To disable colors you can pass the following arguments in the command line to your application:
|
||||
|
||||
```bash
|
||||
node myapp.js --no-color
|
||||
```
|
||||
|
||||
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||
|
||||
```js
|
||||
var name = 'Marak';
|
||||
console.log(colors.green('Hello %s'), name);
|
||||
// outputs -> 'Hello Marak'
|
||||
```
|
||||
|
||||
## Custom themes
|
||||
|
||||
### Using standard API
|
||||
|
||||
```js
|
||||
|
||||
var colors = require('colors');
|
||||
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
```
|
||||
|
||||
### Using string safe API
|
||||
|
||||
```js
|
||||
var colors = require('colors/safe');
|
||||
|
||||
// set single property
|
||||
var error = colors.red;
|
||||
error('this is red');
|
||||
|
||||
// set theme
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
```
|
||||
|
||||
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
74
node_modules/cli-table/node_modules/colors/examples/normal-usage.js
generated
vendored
Normal file
74
node_modules/cli-table/node_modules/colors/examples/normal-usage.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
var colors = require('../lib/index');
|
||||
|
||||
console.log("First some yellow text".yellow);
|
||||
|
||||
console.log("Underline that text".yellow.underline);
|
||||
|
||||
console.log("Make it bold and red".red.bold);
|
||||
|
||||
console.log(("Double Raindows All Day Long").rainbow)
|
||||
|
||||
console.log("Drop the bass".trap)
|
||||
|
||||
console.log("DROP THE RAINBOW BASS".trap.rainbow)
|
||||
|
||||
|
||||
console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
|
||||
|
||||
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse + ' styles! '.yellow.bold); // styles not widely supported
|
||||
console.log("Zebras are so fun!".zebra);
|
||||
|
||||
//
|
||||
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||
//
|
||||
console.log("This is " + "not".strikethrough + " fun.");
|
||||
|
||||
console.log('Background color attack!'.black.bgWhite)
|
||||
console.log('Use random styles on everything!'.random)
|
||||
console.log('America, Heck Yeah!'.america)
|
||||
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log("this is an error".error);
|
||||
|
||||
// outputs yellow text
|
||||
console.log("this is a warning".warn);
|
||||
|
||||
// outputs grey text
|
||||
console.log("this is an input".input);
|
||||
|
||||
//console.log("Don't summon".zalgo)
|
76
node_modules/cli-table/node_modules/colors/examples/safe-string.js
generated
vendored
Normal file
76
node_modules/cli-table/node_modules/colors/examples/safe-string.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
var colors = require('../safe');
|
||||
|
||||
console.log(colors.yellow("First some yellow text"));
|
||||
|
||||
console.log(colors.yellow.underline("Underline that text"));
|
||||
|
||||
console.log(colors.red.bold("Make it bold and red"));
|
||||
|
||||
console.log(colors.rainbow("Double Raindows All Day Long"))
|
||||
|
||||
console.log(colors.trap("Drop the bass"))
|
||||
|
||||
console.log(colors.rainbow(colors.trap("DROP THE RAINBOW BASS")));
|
||||
|
||||
console.log(colors.bold.italic.underline.red('Chains are also cool.')); // styles not widely supported
|
||||
|
||||
|
||||
console.log(colors.green('So ') + colors.underline('are') + ' ' + colors.inverse('inverse') + colors.yellow.bold(' styles! ')); // styles not widely supported
|
||||
|
||||
console.log(colors.zebra("Zebras are so fun!"));
|
||||
|
||||
console.log("This is " + colors.strikethrough("not") + " fun.");
|
||||
|
||||
|
||||
console.log(colors.black.bgWhite('Background color attack!'));
|
||||
console.log(colors.random('Use random styles on everything!'))
|
||||
console.log(colors.america('America, Heck Yeah!'));
|
||||
|
||||
console.log('Setting themes is useful')
|
||||
|
||||
//
|
||||
// Custom themes
|
||||
//
|
||||
//console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||
// Load theme with JSON literal
|
||||
colors.setTheme({
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
});
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
|
||||
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||
|
||||
// Load a theme from file
|
||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
||||
|
||||
// outputs red text
|
||||
console.log(colors.error("this is an error"));
|
||||
|
||||
// outputs yellow text
|
||||
console.log(colors.warn("this is a warning"));
|
||||
|
||||
// outputs grey text
|
||||
console.log(colors.input("this is an input"));
|
||||
|
||||
// console.log(colors.zalgo("Don't summon him"))
|
||||
|
||||
|
||||
|
176
node_modules/cli-table/node_modules/colors/lib/colors.js
generated
vendored
Normal file
176
node_modules/cli-table/node_modules/colors/lib/colors.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Original Library
|
||||
- Copyright (c) Marak Squires
|
||||
|
||||
Additional functionality
|
||||
- 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.
|
||||
|
||||
*/
|
||||
|
||||
var colors = {};
|
||||
module['exports'] = colors;
|
||||
|
||||
colors.themes = {};
|
||||
|
||||
var ansiStyles = colors.styles = require('./styles');
|
||||
var defineProps = Object.defineProperties;
|
||||
|
||||
colors.supportsColor = require('./system/supports-colors');
|
||||
|
||||
if (typeof colors.enabled === "undefined") {
|
||||
colors.enabled = colors.supportsColor;
|
||||
}
|
||||
|
||||
colors.stripColors = colors.strip = function(str){
|
||||
return ("" + str).replace(/\x1B\[\d+m/g, '');
|
||||
};
|
||||
|
||||
|
||||
var stylize = colors.stylize = function stylize (str, style) {
|
||||
return ansiStyles[style].open + str + ansiStyles[style].close;
|
||||
}
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
var escapeStringRegexp = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
}
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function builder() {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
builder._styles = _styles;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
builder.__proto__ = proto;
|
||||
return builder;
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
ansiStyles.grey = ansiStyles.gray;
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build(this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function colors() {}, styles);
|
||||
|
||||
function applyStyle() {
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
if (argsLen > 1) {
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!colors.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
var i = nestedStyles.length;
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function applyTheme (theme) {
|
||||
for (var style in theme) {
|
||||
(function(style){
|
||||
colors[style] = function(str){
|
||||
return colors[theme[style]](str);
|
||||
};
|
||||
})(style)
|
||||
}
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build([name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
var exploded = str.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
};
|
||||
|
||||
// custom formatter methods
|
||||
colors.trap = require('./custom/trap');
|
||||
colors.zalgo = require('./custom/zalgo');
|
||||
|
||||
// maps
|
||||
colors.maps = {};
|
||||
colors.maps.america = require('./maps/america');
|
||||
colors.maps.zebra = require('./maps/zebra');
|
||||
colors.maps.rainbow = require('./maps/rainbow');
|
||||
colors.maps.random = require('./maps/random')
|
||||
|
||||
for (var map in colors.maps) {
|
||||
(function(map){
|
||||
colors[map] = function (str) {
|
||||
return sequencer(colors.maps[map], str);
|
||||
}
|
||||
})(map)
|
||||
}
|
||||
|
||||
defineProps(colors, init());
|
45
node_modules/cli-table/node_modules/colors/lib/custom/trap.js
generated
vendored
Normal file
45
node_modules/cli-table/node_modules/colors/lib/custom/trap.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
module['exports'] = function runTheTrap (text, options) {
|
||||
var result = "";
|
||||
text = text || "Run the trap, drop the bass";
|
||||
text = text.split('');
|
||||
var trap = {
|
||||
a: ["\u0040", "\u0104", "\u023a", "\u0245", "\u0394", "\u039b", "\u0414"],
|
||||
b: ["\u00df", "\u0181", "\u0243", "\u026e", "\u03b2", "\u0e3f"],
|
||||
c: ["\u00a9", "\u023b", "\u03fe"],
|
||||
d: ["\u00d0", "\u018a", "\u0500" , "\u0501" ,"\u0502", "\u0503"],
|
||||
e: ["\u00cb", "\u0115", "\u018e", "\u0258", "\u03a3", "\u03be", "\u04bc", "\u0a6c"],
|
||||
f: ["\u04fa"],
|
||||
g: ["\u0262"],
|
||||
h: ["\u0126", "\u0195", "\u04a2", "\u04ba", "\u04c7", "\u050a"],
|
||||
i: ["\u0f0f"],
|
||||
j: ["\u0134"],
|
||||
k: ["\u0138", "\u04a0", "\u04c3", "\u051e"],
|
||||
l: ["\u0139"],
|
||||
m: ["\u028d", "\u04cd", "\u04ce", "\u0520", "\u0521", "\u0d69"],
|
||||
n: ["\u00d1", "\u014b", "\u019d", "\u0376", "\u03a0", "\u048a"],
|
||||
o: ["\u00d8", "\u00f5", "\u00f8", "\u01fe", "\u0298", "\u047a", "\u05dd", "\u06dd", "\u0e4f"],
|
||||
p: ["\u01f7", "\u048e"],
|
||||
q: ["\u09cd"],
|
||||
r: ["\u00ae", "\u01a6", "\u0210", "\u024c", "\u0280", "\u042f"],
|
||||
s: ["\u00a7", "\u03de", "\u03df", "\u03e8"],
|
||||
t: ["\u0141", "\u0166", "\u0373"],
|
||||
u: ["\u01b1", "\u054d"],
|
||||
v: ["\u05d8"],
|
||||
w: ["\u0428", "\u0460", "\u047c", "\u0d70"],
|
||||
x: ["\u04b2", "\u04fe", "\u04fc", "\u04fd"],
|
||||
y: ["\u00a5", "\u04b0", "\u04cb"],
|
||||
z: ["\u01b5", "\u0240"]
|
||||
}
|
||||
text.forEach(function(c){
|
||||
c = c.toLowerCase();
|
||||
var chars = trap[c] || [" "];
|
||||
var rand = Math.floor(Math.random() * chars.length);
|
||||
if (typeof trap[c] !== "undefined") {
|
||||
result += trap[c][rand];
|
||||
} else {
|
||||
result += c;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
104
node_modules/cli-table/node_modules/colors/lib/custom/zalgo.js
generated
vendored
Normal file
104
node_modules/cli-table/node_modules/colors/lib/custom/zalgo.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// please no
|
||||
module['exports'] = function zalgo(text, options) {
|
||||
text = text || " he is here ";
|
||||
var soul = {
|
||||
"up" : [
|
||||
'̍', '̎', '̄', '̅',
|
||||
'̿', '̑', '̆', '̐',
|
||||
'͒', '͗', '͑', '̇',
|
||||
'̈', '̊', '͂', '̓',
|
||||
'̈', '͊', '͋', '͌',
|
||||
'̃', '̂', '̌', '͐',
|
||||
'̀', '́', '̋', '̏',
|
||||
'̒', '̓', '̔', '̽',
|
||||
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||
'ͮ', 'ͯ', '̾', '͛',
|
||||
'͆', '̚'
|
||||
],
|
||||
"down" : [
|
||||
'̖', '̗', '̘', '̙',
|
||||
'̜', '̝', '̞', '̟',
|
||||
'̠', '̤', '̥', '̦',
|
||||
'̩', '̪', '̫', '̬',
|
||||
'̭', '̮', '̯', '̰',
|
||||
'̱', '̲', '̳', '̹',
|
||||
'̺', '̻', '̼', 'ͅ',
|
||||
'͇', '͈', '͉', '͍',
|
||||
'͎', '͓', '͔', '͕',
|
||||
'͖', '͙', '͚', '̣'
|
||||
],
|
||||
"mid" : [
|
||||
'̕', '̛', '̀', '́',
|
||||
'͘', '̡', '̢', '̧',
|
||||
'̨', '̴', '̵', '̶',
|
||||
'͜', '͝', '͞',
|
||||
'͟', '͠', '͢', '̸',
|
||||
'̷', '͡', ' ҉'
|
||||
]
|
||||
},
|
||||
all = [].concat(soul.up, soul.down, soul.mid),
|
||||
zalgo = {};
|
||||
|
||||
function randomNumber(range) {
|
||||
var r = Math.floor(Math.random() * range);
|
||||
return r;
|
||||
}
|
||||
|
||||
function is_char(character) {
|
||||
var bool = false;
|
||||
all.filter(function (i) {
|
||||
bool = (i === character);
|
||||
});
|
||||
return bool;
|
||||
}
|
||||
|
||||
|
||||
function heComes(text, options) {
|
||||
var result = '', counts, l;
|
||||
options = options || {};
|
||||
options["up"] = options["up"] || true;
|
||||
options["mid"] = options["mid"] || true;
|
||||
options["down"] = options["down"] || true;
|
||||
options["size"] = options["size"] || "maxi";
|
||||
text = text.split('');
|
||||
for (l in text) {
|
||||
if (is_char(l)) {
|
||||
continue;
|
||||
}
|
||||
result = result + text[l];
|
||||
counts = {"up" : 0, "down" : 0, "mid" : 0};
|
||||
switch (options.size) {
|
||||
case 'mini':
|
||||
counts.up = randomNumber(8);
|
||||
counts.min = randomNumber(2);
|
||||
counts.down = randomNumber(8);
|
||||
break;
|
||||
case 'maxi':
|
||||
counts.up = randomNumber(16) + 3;
|
||||
counts.min = randomNumber(4) + 1;
|
||||
counts.down = randomNumber(64) + 3;
|
||||
break;
|
||||
default:
|
||||
counts.up = randomNumber(8) + 1;
|
||||
counts.mid = randomNumber(6) / 2;
|
||||
counts.down = randomNumber(8) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
var arr = ["up", "mid", "down"];
|
||||
for (var d in arr) {
|
||||
var index = arr[d];
|
||||
for (var i = 0 ; i <= counts[index]; i++) {
|
||||
if (options[index]) {
|
||||
result = result + soul[index][randomNumber(soul[index].length)];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// don't summon him
|
||||
return heComes(text);
|
||||
}
|
118
node_modules/cli-table/node_modules/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
118
node_modules/cli-table/node_modules/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
var colors = require('./colors'),
|
||||
styles = require('./styles');
|
||||
|
||||
module['exports'] = function () {
|
||||
|
||||
//
|
||||
// Extends prototype of native string object to allow for "foo".red syntax
|
||||
//
|
||||
var addProperty = function (color, func) {
|
||||
String.prototype.__defineGetter__(color, func);
|
||||
};
|
||||
|
||||
var sequencer = function sequencer (map, str) {
|
||||
return function () {
|
||||
var exploded = this.split(""), i = 0;
|
||||
exploded = exploded.map(map);
|
||||
return exploded.join("");
|
||||
}
|
||||
};
|
||||
|
||||
var stylize = function stylize (str, style) {
|
||||
return styles[style].open + str + styles[style].close;
|
||||
}
|
||||
|
||||
addProperty('strip', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty('stripColors', function () {
|
||||
return colors.strip(this);
|
||||
});
|
||||
|
||||
addProperty("trap", function(){
|
||||
return colors.trap(this);
|
||||
});
|
||||
|
||||
addProperty("zalgo", function(){
|
||||
return colors.zalgo(this);
|
||||
});
|
||||
|
||||
addProperty("zebra", function(){
|
||||
return colors.zebra(this);
|
||||
});
|
||||
|
||||
addProperty("rainbow", function(){
|
||||
return colors.rainbow(this);
|
||||
});
|
||||
|
||||
addProperty("random", function(){
|
||||
return colors.random(this);
|
||||
});
|
||||
|
||||
addProperty("america", function(){
|
||||
return colors.america(this);
|
||||
});
|
||||
|
||||
//
|
||||
// Iterate through all default styles and colors
|
||||
//
|
||||
var x = Object.keys(colors.styles);
|
||||
x.forEach(function (style) {
|
||||
addProperty(style, function () {
|
||||
return stylize(this, style);
|
||||
});
|
||||
});
|
||||
|
||||
function applyTheme(theme) {
|
||||
//
|
||||
// Remark: This is a list of methods that exist
|
||||
// on String that you should not overwrite.
|
||||
//
|
||||
var stringPrototypeBlacklist = [
|
||||
'__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
|
||||
'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
|
||||
'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
|
||||
'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
|
||||
];
|
||||
|
||||
Object.keys(theme).forEach(function (prop) {
|
||||
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||
console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
|
||||
}
|
||||
else {
|
||||
if (typeof(theme[prop]) === 'string') {
|
||||
colors[prop] = colors[theme[prop]];
|
||||
addProperty(prop, function () {
|
||||
return colors[theme[prop]](this);
|
||||
});
|
||||
}
|
||||
else {
|
||||
addProperty(prop, function () {
|
||||
var ret = this;
|
||||
for (var t = 0; t < theme[prop].length; t++) {
|
||||
ret = exports[theme[prop][t]](ret);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
colors.setTheme = function (theme) {
|
||||
if (typeof theme === 'string') {
|
||||
try {
|
||||
colors.themes[theme] = require(theme);
|
||||
applyTheme(colors.themes[theme]);
|
||||
return colors.themes[theme];
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
applyTheme(theme);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
12
node_modules/cli-table/node_modules/colors/lib/index.js
generated
vendored
Normal file
12
node_modules/cli-table/node_modules/colors/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('./colors');
|
||||
module['exports'] = colors;
|
||||
|
||||
// Remark: By default, colors will add style properties to String.prototype
|
||||
//
|
||||
// If you don't wish to extend String.prototype you can do this instead and native String will not be touched
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var extendStringPrototype = require('./extendStringPrototype')();
|
12
node_modules/cli-table/node_modules/colors/lib/maps/america.js
generated
vendored
Normal file
12
node_modules/cli-table/node_modules/colors/lib/maps/america.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function() {
|
||||
return function (letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return colors.red(letter);
|
||||
case 1: return colors.white(letter)
|
||||
case 2: return colors.blue(letter)
|
||||
}
|
||||
}
|
||||
})();
|
13
node_modules/cli-table/node_modules/colors/lib/maps/rainbow.js
generated
vendored
Normal file
13
node_modules/cli-table/node_modules/colors/lib/maps/rainbow.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
|
||||
return function (letter, i, exploded) {
|
||||
if (letter === " ") {
|
||||
return letter;
|
||||
} else {
|
||||
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
8
node_modules/cli-table/node_modules/colors/lib/maps/random.js
generated
vendored
Normal file
8
node_modules/cli-table/node_modules/colors/lib/maps/random.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = (function () {
|
||||
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : colors[available[Math.round(Math.random() * (available.length - 1))]](letter);
|
||||
};
|
||||
})();
|
5
node_modules/cli-table/node_modules/colors/lib/maps/zebra.js
generated
vendored
Normal file
5
node_modules/cli-table/node_modules/colors/lib/maps/zebra.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var colors = require('../colors');
|
||||
|
||||
module['exports'] = function (letter, i, exploded) {
|
||||
return i % 2 === 0 ? letter : colors.inverse(letter);
|
||||
};
|
77
node_modules/cli-table/node_modules/colors/lib/styles.js
generated
vendored
Normal file
77
node_modules/cli-table/node_modules/colors/lib/styles.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
var styles = {};
|
||||
module['exports'] = styles;
|
||||
|
||||
var codes = {
|
||||
reset: [0, 0],
|
||||
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
grey: [90, 39],
|
||||
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// legacy styles for colors pre v1.0.0
|
||||
blackBG: [40, 49],
|
||||
redBG: [41, 49],
|
||||
greenBG: [42, 49],
|
||||
yellowBG: [43, 49],
|
||||
blueBG: [44, 49],
|
||||
magentaBG: [45, 49],
|
||||
cyanBG: [46, 49],
|
||||
whiteBG: [47, 49]
|
||||
|
||||
};
|
||||
|
||||
Object.keys(codes).forEach(function (key) {
|
||||
var val = codes[key];
|
||||
var style = styles[key] = [];
|
||||
style.open = '\u001b[' + val[0] + 'm';
|
||||
style.close = '\u001b[' + val[1] + 'm';
|
||||
});
|
61
node_modules/cli-table/node_modules/colors/lib/system/supports-colors.js
generated
vendored
Normal file
61
node_modules/cli-table/node_modules/colors/lib/system/supports-colors.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
var argv = process.argv;
|
||||
|
||||
module.exports = (function () {
|
||||
if (argv.indexOf('--no-color') !== -1 ||
|
||||
argv.indexOf('--color=false') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (argv.indexOf('--color') !== -1 ||
|
||||
argv.indexOf('--color=true') !== -1 ||
|
||||
argv.indexOf('--color=always') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.stdout && !process.stdout.isTTY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in process.env) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.env.TERM === 'dumb') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})();
|
21
node_modules/cli-table/node_modules/colors/package.json
generated
vendored
Normal file
21
node_modules/cli-table/node_modules/colors/package.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "colors",
|
||||
"description": "get colors in your node.js console",
|
||||
"version": "1.0.3",
|
||||
"author": "Marak Squires",
|
||||
"homepage": "https://github.com/Marak/colors.js",
|
||||
"bugs": "https://github.com/Marak/colors.js/issues",
|
||||
"keywords": [ "ansi", "terminal", "colors" ],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/Marak/colors.js.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "node tests/basic-test.js && node tests/safe-test.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1.90"
|
||||
},
|
||||
"main": "./lib/index"
|
||||
}
|
9
node_modules/cli-table/node_modules/colors/safe.js
generated
vendored
Normal file
9
node_modules/cli-table/node_modules/colors/safe.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Remark: Requiring this file will use the "safe" colors API which will not touch String.prototype
|
||||
//
|
||||
// var colors = require('colors/safe);
|
||||
// colors.red("foo")
|
||||
//
|
||||
//
|
||||
var colors = require('./lib/colors');
|
||||
module['exports'] = colors;
|
BIN
node_modules/cli-table/node_modules/colors/screenshots/colors.png
generated
vendored
Normal file
BIN
node_modules/cli-table/node_modules/colors/screenshots/colors.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
50
node_modules/cli-table/node_modules/colors/tests/basic-test.js
generated
vendored
Normal file
50
node_modules/cli-table/node_modules/colors/tests/basic-test.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../lib/index');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(s[color], a(s, code));
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(s[color], colors[color](s));
|
||||
assert.equal(s[color].strip, s);
|
||||
assert.equal(s[color].strip, colors.strip(s));
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(s.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof("astring".red),'string');
|
||||
assert.equal(typeof("astring".error),'string');
|
||||
|
45
node_modules/cli-table/node_modules/colors/tests/safe-test.js
generated
vendored
Normal file
45
node_modules/cli-table/node_modules/colors/tests/safe-test.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
var assert = require('assert'),
|
||||
colors = require('../safe');
|
||||
|
||||
var s = 'string';
|
||||
|
||||
function a(s, code) {
|
||||
return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
|
||||
}
|
||||
|
||||
function aE(s, color, code) {
|
||||
assert.equal(colors[color](s), a(s, code));
|
||||
assert.equal(colors.strip(s), s);
|
||||
}
|
||||
|
||||
function h(s, color) {
|
||||
return '<span style="color:' + color + ';">' + s + '</span>';
|
||||
}
|
||||
|
||||
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
|
||||
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
|
||||
|
||||
colors.mode = 'console';
|
||||
assert.equal(colors.bold(s), '\x1B[1m' + s + '\x1B[22m');
|
||||
assert.equal(colors.italic(s), '\x1B[3m' + s + '\x1B[23m');
|
||||
assert.equal(colors.underline(s), '\x1B[4m' + s + '\x1B[24m');
|
||||
assert.equal(colors.strikethrough(s), '\x1B[9m' + s + '\x1B[29m');
|
||||
assert.equal(colors.inverse(s), '\x1B[7m' + s + '\x1B[27m');
|
||||
|
||||
assert.ok(colors.rainbow);
|
||||
|
||||
aE(s, 'white', 37);
|
||||
aE(s, 'grey', 90);
|
||||
aE(s, 'black', 30);
|
||||
aE(s, 'blue', 34);
|
||||
aE(s, 'cyan', 36);
|
||||
aE(s, 'green', 32);
|
||||
aE(s, 'magenta', 35);
|
||||
aE(s, 'red', 31);
|
||||
aE(s, 'yellow', 33);
|
||||
|
||||
assert.equal(s, 'string');
|
||||
colors.setTheme({error:'red'});
|
||||
|
||||
assert.equal(typeof(colors.red("astring")), 'string');
|
||||
assert.equal(typeof(colors.error("astring")), 'string');
|
12
node_modules/cli-table/node_modules/colors/themes/generic-logging.js
generated
vendored
Normal file
12
node_modules/cli-table/node_modules/colors/themes/generic-logging.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module['exports'] = {
|
||||
silly: 'rainbow',
|
||||
input: 'grey',
|
||||
verbose: 'cyan',
|
||||
prompt: 'grey',
|
||||
info: 'green',
|
||||
data: 'grey',
|
||||
help: 'cyan',
|
||||
warn: 'yellow',
|
||||
debug: 'blue',
|
||||
error: 'red'
|
||||
};
|
1
node_modules/cli-table/package.json
generated
vendored
Normal file
1
node_modules/cli-table/package.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"cli-table","description":"Pretty unicode tables for the CLI","version":"0.3.6","author":"Guillermo Rauch <guillermo@learnboost.com>","contributors":["Sonny Michaud <michaud.sonny@gmail.com> (http://github.com/sonnym)"],"repository":{"type":"git","url":"https://github.com/Automattic/cli-table.git"},"keywords":["cli","colors","table"],"dependencies":{"colors":"1.0.3"},"devDependencies":{"expresso":"~0.9","should":"~0.6"},"main":"lib","files":["lib"],"scripts":{"test":"make test"},"engines":{"node":">= 0.2.0"}}
|
Reference in New Issue
Block a user