aboutsummaryrefslogtreecommitdiff
path: root/node_modules/has-flag
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/has-flag')
-rw-r--r--node_modules/has-flag/index.js10
-rw-r--r--node_modules/has-flag/license21
-rw-r--r--node_modules/has-flag/package.json48
-rw-r--r--node_modules/has-flag/readme.md64
4 files changed, 143 insertions, 0 deletions
diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js
new file mode 100644
index 000000000..fdcb342f4
--- /dev/null
+++ b/node_modules/has-flag/index.js
@@ -0,0 +1,10 @@
+'use strict';
+module.exports = function (flag, argv) {
+ argv = argv || process.argv;
+
+ var terminatorPos = argv.indexOf('--');
+ var prefix = /^--/.test(flag) ? '' : '--';
+ var pos = argv.indexOf(prefix + flag);
+
+ return pos !== -1 && (terminatorPos !== -1 ? pos < terminatorPos : true);
+};
diff --git a/node_modules/has-flag/license b/node_modules/has-flag/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/has-flag/license
@@ -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.
diff --git a/node_modules/has-flag/package.json b/node_modules/has-flag/package.json
new file mode 100644
index 000000000..930dc7ff2
--- /dev/null
+++ b/node_modules/has-flag/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "has-flag",
+ "version": "1.0.0",
+ "description": "Check if argv has a specific flag",
+ "license": "MIT",
+ "repository": "sindresorhus/has-flag",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "maintainers": [
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
+ "Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
+ "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
+ ],
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "node test.js"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "has",
+ "check",
+ "detect",
+ "contains",
+ "find",
+ "flag",
+ "cli",
+ "command-line",
+ "argv",
+ "process",
+ "arg",
+ "args",
+ "argument",
+ "arguments",
+ "getopt",
+ "minimist",
+ "optimist"
+ ],
+ "devDependencies": {
+ "ava": "0.0.4"
+ }
+}
diff --git a/node_modules/has-flag/readme.md b/node_modules/has-flag/readme.md
new file mode 100644
index 000000000..ea5c81793
--- /dev/null
+++ b/node_modules/has-flag/readme.md
@@ -0,0 +1,64 @@
+# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
+
+> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
+
+Correctly stops looking after an `--` argument terminator.
+
+
+## Install
+
+```
+$ npm install --save has-flag
+```
+
+
+## Usage
+
+```js
+// foo.js
+var hasFlag = require('has-flag');
+
+hasFlag('unicorn');
+//=> true
+
+hasFlag('--unicorn');
+//=> true
+
+hasFlag('foo=bar');
+//=> true
+
+hasFlag('foo');
+//=> false
+
+hasFlag('rainbow');
+//=> false
+```
+
+```
+$ node foo.js --unicorn --foo=bar -- --rainbow
+```
+
+
+## API
+
+### hasFlag(flag, [argv])
+
+Returns a boolean whether the flag exists.
+
+#### flag
+
+Type: `string`
+
+CLI flag to look for. The `--` prefix is optional.
+
+#### argv
+
+Type: `array`
+Default: `process.argv`
+
+CLI arguments.
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)