diff options
Diffstat (limited to 'tools/node_modules/eslint/node_modules/cli-width')
4 files changed, 193 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/node_modules/cli-width/LICENSE b/tools/node_modules/eslint/node_modules/cli-width/LICENSE new file mode 100644 index 0000000000..173ed31910 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Ilya Radchenko <ilya@burstcreations.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/tools/node_modules/eslint/node_modules/cli-width/README.md b/tools/node_modules/eslint/node_modules/cli-width/README.md new file mode 100644 index 0000000000..b7157ea528 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/README.md @@ -0,0 +1,72 @@ +cli-width +========= + +Get stdout window width, with four fallbacks, `tty`, `output.columns`, a custom environment variable and then a default. + +[![npm version](https://badge.fury.io/js/cli-width.svg)](http://badge.fury.io/js/cli-width) +[![Build Status](https://travis-ci.org/knownasilya/cli-width.svg)](https://travis-ci.org/knownasilya/cli-width) +[![Coverage Status](https://coveralls.io/repos/knownasilya/cli-width/badge.svg?branch=master&service=github)](https://coveralls.io/github/knownasilya/cli-width?branch=master) + +## Usage + +``` +npm install --save cli-width +``` + +```js +'use strict'; + +var cliWidth = require('cli-width'); + +cliWidth(); // maybe 204 :) +``` + +You can also set the `CLI_WIDTH` environment variable. + +If none of the methods are supported, and the environment variable isn't set, +the default width value is going to be `0`, that can be changed using the configurable `options`. + +## API + +### cliWidth([options]) + +`cliWidth` can be configured using an `options` parameter, the possible properties are: + +- **defaultWidth**\<number\> Defines a default value to be used if none of the methods are available, defaults to `0` +- **output**\<object\> A stream to be used to read width values from, defaults to `process.stdout` +- **tty**\<object\> TTY module to try to read width from as a fallback, defaults to `require('tty')` + + +### Examples + +Defining both a default width value and a stream output to try to read from: + +```js +var cliWidth = require('cli-width'); +var ttys = require('ttys'); + +cliWidth({ + defaultWidth: 80, + output: ttys.output +}); +``` + +Defines a different tty module to read width from: + +```js +var cliWidth = require('cli-width'); +var ttys = require('ttys'); + +cliWidth({ + tty: ttys +}); +``` + +## Tests + +```bash +npm install +npm test +``` + +Coverage can be generated with `npm run coverage`. diff --git a/tools/node_modules/eslint/node_modules/cli-width/index.js b/tools/node_modules/eslint/node_modules/cli-width/index.js new file mode 100644 index 0000000000..de939f3194 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/index.js @@ -0,0 +1,49 @@ +'use strict'; + +exports = module.exports = cliWidth; + +function normalizeOpts(options) { + var defaultOpts = { + defaultWidth: 0, + output: process.stdout, + tty: require('tty') + }; + + if (!options) { + return defaultOpts; + } else { + Object.keys(defaultOpts).forEach(function (key) { + if (!options[key]) { + options[key] = defaultOpts[key]; + } + }); + + return options; + } +} + +function cliWidth(options) { + var opts = normalizeOpts(options); + + if (opts.output.getWindowSize) { + return opts.output.getWindowSize()[0] || opts.defaultWidth; + } else { + if (opts.tty.getWindowSize) { + return opts.tty.getWindowSize()[1] || opts.defaultWidth; + } else { + if (opts.output.columns) { + return opts.output.columns; + } else { + if (process.env.CLI_WIDTH) { + var width = parseInt(process.env.CLI_WIDTH, 10); + + if (!isNaN(width) && width !== 0) { + return width; + } + } + } + + return opts.defaultWidth; + } + } +}; diff --git a/tools/node_modules/eslint/node_modules/cli-width/package.json b/tools/node_modules/eslint/node_modules/cli-width/package.json new file mode 100644 index 0000000000..0b0c2c5345 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/cli-width/package.json @@ -0,0 +1,59 @@ +{ + "_from": "cli-width@^2.0.0", + "_id": "cli-width@2.2.0", + "_inBundle": false, + "_integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "_location": "/eslint/cli-width", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "cli-width@^2.0.0", + "name": "cli-width", + "escapedName": "cli-width", + "rawSpec": "^2.0.0", + "saveSpec": null, + "fetchSpec": "^2.0.0" + }, + "_requiredBy": [ + "/eslint/inquirer" + ], + "_resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "_shasum": "ff19ede8a9a5e579324147b0c11f0fbcbabed639", + "_spec": "cli-width@^2.0.0", + "_where": "/Users/cjihrig/iojs/node/tools/eslint-tmp/node_modules/eslint/node_modules/inquirer", + "author": { + "name": "Ilya Radchenko", + "email": "ilya@burstcreations.com" + }, + "bugs": { + "url": "https://github.com/knownasilya/cli-width/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Get stdout window width, with two fallbacks, tty and then a default.", + "devDependencies": { + "coveralls": "^2.11.4", + "isparta": "^3.0.4", + "rimraf": "^2.4.3", + "standard-version": "^4.2.0", + "tap-spec": "^4.1.0", + "tape": "^3.4.0" + }, + "homepage": "https://github.com/knownasilya/cli-width", + "license": "ISC", + "main": "index.js", + "name": "cli-width", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/knownasilya/cli-width.git" + }, + "scripts": { + "coverage": "isparta cover test/*.js | tspec", + "coveralls": "npm run coverage -s && coveralls < coverage/lcov.info", + "postcoveralls": "rimraf ./coverage", + "release": "standard-version", + "test": "node test | tspec" + }, + "version": "2.2.0" +} |