diff options
author | Quim Calpe <quim@kalpe.com> | 2013-11-23 03:31:43 +0400 |
---|---|---|
committer | Domenic Denicola <domenic@domenicdenicola.com> | 2013-11-26 10:03:45 +0400 |
commit | fd3017fc3e9d42acf6394a5285122edb4dc16106 (patch) | |
tree | 586d66bc79af12563f31a50c75cafab4d698b7fb /node_modules/ansistyles | |
parent | ec2c50f9bc926c3034ac8c5e166cdaf2c42e53e9 (diff) |
Make `npm outdated` output prettier.
Fixes #4176. Uses ansicolors, ansistyles, and text-table.
Diffstat (limited to 'node_modules/ansistyles')
-rw-r--r-- | node_modules/ansistyles/.npmignore | 15 | ||||
-rw-r--r-- | node_modules/ansistyles/.travis.yml | 4 | ||||
-rw-r--r-- | node_modules/ansistyles/LICENSE | 23 | ||||
-rw-r--r-- | node_modules/ansistyles/README.md | 71 | ||||
-rw-r--r-- | node_modules/ansistyles/ansistyles.js | 38 | ||||
-rw-r--r-- | node_modules/ansistyles/package.json | 34 | ||||
-rw-r--r-- | node_modules/ansistyles/test/ansistyles.js | 15 |
7 files changed, 200 insertions, 0 deletions
diff --git a/node_modules/ansistyles/.npmignore b/node_modules/ansistyles/.npmignore new file mode 100644 index 000000000..a72b52ebe --- /dev/null +++ b/node_modules/ansistyles/.npmignore @@ -0,0 +1,15 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz + +pids +logs +results + +npm-debug.log +node_modules diff --git a/node_modules/ansistyles/.travis.yml b/node_modules/ansistyles/.travis.yml new file mode 100644 index 000000000..895dbd362 --- /dev/null +++ b/node_modules/ansistyles/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 diff --git a/node_modules/ansistyles/LICENSE b/node_modules/ansistyles/LICENSE new file mode 100644 index 000000000..41702c504 --- /dev/null +++ b/node_modules/ansistyles/LICENSE @@ -0,0 +1,23 @@ +Copyright 2013 Thorsten Lorenz. +All rights reserved. + +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. diff --git a/node_modules/ansistyles/README.md b/node_modules/ansistyles/README.md new file mode 100644 index 000000000..e39b8dfb6 --- /dev/null +++ b/node_modules/ansistyles/README.md @@ -0,0 +1,71 @@ +# ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles) + +Functions that surround a string with ansistyle codes so it prints in style. + +In case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors). + +## Installation + + npm install ansistyles + +## Usage + +```js +var styles = require('ansistyles'); + +console.log(styles.bright('hello world')); // prints hello world in 'bright' white +console.log(styles.underline('hello world')); // prints hello world underlined +console.log(styles.inverse('hello world')); // prints hello world black on white +``` + +## Combining with ansicolors + +Get the ansicolors module: + + npm install ansicolors + +```js +var styles = require('ansistyles') + , colors = require('ansicolors'); + + console.log( + // prints hello world underlined in blue on a green background + colors.bgGreen(colors.blue(styles.underline('hello world'))) + ); +``` + +## Tests + +Look at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via: + + npm explore ansistyles && npm test + +## More Styles + +As you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available, +but didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux. + +I included them for completeness, but didn't show them in the examples because they seem to have no effect. + +### reset + +A style reset function is also included, please note however that this is not nestable. + +Therefore the below only underlines `hell` only, but not `world`. + +```js +console.log(styles.underline('hell' + styles.reset('o') + ' world')); +``` + +It is essentially the same as: + +```js +console.log(styles.underline('hell') + styles.reset('') + 'o world'); +``` + + + +## Alternatives + +**ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, +I'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js). diff --git a/node_modules/ansistyles/ansistyles.js b/node_modules/ansistyles/ansistyles.js new file mode 100644 index 000000000..5b8788c0f --- /dev/null +++ b/node_modules/ansistyles/ansistyles.js @@ -0,0 +1,38 @@ +'use strict'; + +/* + * Info: http://www.termsys.demon.co.uk/vtansi.htm#colors + * Following caveats + * bright - brightens the color (bold-blue is same as brigthtBlue) + * dim - nothing on Mac or Linux + * italic - nothing on Mac or Linux + * underline - underlines string + * blink - nothing on Mac or linux + * inverse - background becomes foreground and vice versa + * + * In summary, the only styles that work are: + * - bright, underline and inverse + * - the others are only included for completeness + */ + +var styleNums = { + reset : [0, 22] + , bright : [1, 22] + , dim : [2, 22] + , italic : [3, 23] + , underline : [4, 24] + , blink : [5, 25] + , inverse : [7, 27] + } + , styles = {} + ; + +Object.keys(styleNums).forEach(function (k) { + styles[k] = function (s) { + var open = styleNums[k][0] + , close = styleNums[k][1]; + return '\u001b[' + open + 'm' + s + '\u001b[' + close + 'm'; + }; +}); + +module.exports = styles; diff --git a/node_modules/ansistyles/package.json b/node_modules/ansistyles/package.json new file mode 100644 index 000000000..a36a6fb5d --- /dev/null +++ b/node_modules/ansistyles/package.json @@ -0,0 +1,34 @@ +{ + "name": "ansistyles", + "version": "0.1.2", + "description": "Functions that surround a string with ansistyle codes so it prints in style.", + "main": "ansistyles.js", + "scripts": { + "test": "node test/ansistyles.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/thlorenz/ansistyles.git" + }, + "keywords": [ + "ansi", + "style", + "terminal", + "console" + ], + "author": { + "name": "Thorsten Lorenz", + "email": "thlorenz@gmx.de", + "url": "thlorenz.com" + }, + "license": "MIT", + "readmeFilename": "README.md", + "gitHead": "27bf1bc65231bcc7fd109bf13b13601b51f8cd04", + "readme": "# ansistyles [![build status](https://secure.travis-ci.org/thlorenz/ansistyles.png)](http://next.travis-ci.org/thlorenz/ansistyles)\n\nFunctions that surround a string with ansistyle codes so it prints in style.\n\nIn case you need colors, like `red`, have a look at [ansicolors](https://github.com/thlorenz/ansicolors).\n\n## Installation\n\n npm install ansistyles\n\n## Usage\n\n```js\nvar styles = require('ansistyles');\n\nconsole.log(styles.bright('hello world')); // prints hello world in 'bright' white\nconsole.log(styles.underline('hello world')); // prints hello world underlined\nconsole.log(styles.inverse('hello world')); // prints hello world black on white\n```\n\n## Combining with ansicolors\n\nGet the ansicolors module:\n\n npm install ansicolors\n\n```js\nvar styles = require('ansistyles')\n , colors = require('ansicolors');\n\n console.log(\n // prints hello world underlined in blue on a green background\n colors.bgGreen(colors.blue(styles.underline('hello world'))) \n );\n```\n\n## Tests\n\nLook at the [tests](https://github.com/thlorenz/ansistyles/blob/master/test/ansistyles.js) to see more examples and/or run them via: \n\n npm explore ansistyles && npm test\n\n## More Styles\n\nAs you can see from [here](https://github.com/thlorenz/ansistyles/blob/master/ansistyles.js#L4-L15), more styles are available,\nbut didn't have any effect on the terminals that I tested on Mac Lion and Ubuntu Linux.\n\nI included them for completeness, but didn't show them in the examples because they seem to have no effect.\n\n### reset\n\nA style reset function is also included, please note however that this is not nestable.\n\nTherefore the below only underlines `hell` only, but not `world`.\n\n```js\nconsole.log(styles.underline('hell' + styles.reset('o') + ' world'));\n```\n\nIt is essentially the same as:\n\n```js\nconsole.log(styles.underline('hell') + styles.reset('') + 'o world');\n```\n\n\n\n## Alternatives\n\n**ansistyles** tries to meet simple use cases with a very simple API. However, if you need a more powerful ansi formatting tool, \nI'd suggest to look at the [features](https://github.com/TooTallNate/ansi.js#features) of the [ansi module](https://github.com/TooTallNate/ansi.js).\n", + "bugs": { + "url": "https://github.com/thlorenz/ansistyles/issues" + }, + "homepage": "https://github.com/thlorenz/ansistyles", + "_id": "ansistyles@0.1.2", + "_from": "ansistyles@" +} diff --git a/node_modules/ansistyles/test/ansistyles.js b/node_modules/ansistyles/test/ansistyles.js new file mode 100644 index 000000000..f769bf803 --- /dev/null +++ b/node_modules/ansistyles/test/ansistyles.js @@ -0,0 +1,15 @@ +'use strict'; +/*jshint asi: true */ +var assert = require('assert') + , styles = require('../') + +function inspect(obj, depth) { + console.log(require('util').inspect(obj, false, depth || 5, true)); +} + +assert.equal(styles.reset('reset'), '\u001b[0mreset\u001b[22m', 'reset') +assert.equal(styles.underline('underlined'), '\u001b[4munderlined\u001b[24m', 'underline') +assert.equal(styles.bright('bright'), '\u001b[1mbright\u001b[22m', 'bright') +assert.equal(styles.inverse('inversed'), '\u001b[7minversed\u001b[27m', 'inverse') + +console.log('OK'); |