fsevents 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/abbrev/package.json +1 -1
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/aproba/package.json +1 -1
- package/node_modules/are-we-there-yet/package.json +1 -1
- package/node_modules/balanced-match/package.json +1 -1
- package/node_modules/brace-expansion/package.json +1 -1
- package/node_modules/chownr/chownr.js +58 -16
- package/node_modules/chownr/package.json +13 -10
- package/node_modules/code-point-at/package.json +1 -1
- package/node_modules/concat-map/package.json +1 -1
- package/node_modules/console-control-strings/package.json +1 -1
- package/node_modules/core-util-is/package.json +1 -1
- package/node_modules/debug/package.json +1 -1
- package/node_modules/deep-extend/package.json +1 -1
- package/node_modules/delegates/package.json +1 -1
- package/node_modules/detect-libc/package.json +2 -2
- package/node_modules/fs-minipass/package.json +1 -1
- package/node_modules/fs.realpath/package.json +1 -1
- package/node_modules/gauge/package.json +1 -1
- package/node_modules/glob/package.json +1 -1
- package/node_modules/has-unicode/package.json +1 -1
- package/node_modules/iconv-lite/package.json +1 -1
- package/node_modules/ignore-walk/package.json +1 -1
- package/node_modules/inflight/package.json +1 -1
- package/node_modules/inherits/package.json +1 -1
- package/node_modules/ini/package.json +1 -1
- package/node_modules/is-fullwidth-code-point/package.json +1 -1
- package/node_modules/isarray/package.json +1 -1
- package/node_modules/minimatch/package.json +1 -1
- package/node_modules/minimist/.travis.yml +4 -0
- package/node_modules/minimist/example/parse.js +1 -1
- package/node_modules/minimist/index.js +112 -54
- package/node_modules/minimist/package.json +17 -14
- package/node_modules/minimist/readme.markdown +28 -6
- package/node_modules/{rc/node_modules/minimist → minimist}/test/all_bool.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/bool.js +12 -0
- package/node_modules/minimist/test/dash.js +7 -0
- package/node_modules/minimist/test/default_bool.js +15 -0
- package/node_modules/minimist/test/dotted.js +6 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/kv_short.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/num.js +0 -0
- package/node_modules/minimist/test/parse.js +23 -144
- package/node_modules/minimist/test/parse_modified.js +1 -1
- package/node_modules/minimist/test/proto.js +44 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/stop_early.js +0 -0
- package/node_modules/{rc/node_modules/minimist → minimist}/test/unknown.js +0 -0
- package/node_modules/minipass/package.json +1 -1
- package/node_modules/minizlib/package.json +1 -1
- package/node_modules/mkdirp/package.json +17 -10
- package/node_modules/ms/package.json +1 -1
- package/node_modules/needle/.github/workflows/nodejs.yml +27 -0
- package/node_modules/needle/README.md +5 -5
- package/node_modules/needle/lib/needle.js +9 -3
- package/node_modules/needle/package.json +7 -7
- package/node_modules/needle/test/compression_spec.js +18 -0
- package/node_modules/node-pre-gyp/package.json +9 -8
- package/node_modules/nopt/lib/nopt.js +6 -1
- package/node_modules/nopt/package.json +15 -8
- package/node_modules/npm-bundled/package.json +1 -1
- package/node_modules/npm-normalize-package-bin/package.json +3 -2
- package/node_modules/npm-packlist/package.json +8 -7
- package/node_modules/npmlog/package.json +1 -1
- package/node_modules/number-is-nan/package.json +1 -1
- package/node_modules/object-assign/package.json +1 -1
- package/node_modules/once/package.json +1 -1
- package/node_modules/os-homedir/package.json +1 -1
- package/node_modules/os-tmpdir/package.json +1 -1
- package/node_modules/osenv/package.json +1 -1
- package/node_modules/path-is-absolute/package.json +1 -1
- package/node_modules/process-nextick-args/package.json +1 -1
- package/node_modules/rc/package.json +2 -2
- package/node_modules/readable-stream/.travis.yml +9 -30
- package/node_modules/readable-stream/lib/_stream_duplex.js +1 -1
- package/node_modules/readable-stream/lib/_stream_passthrough.js +1 -1
- package/node_modules/readable-stream/lib/_stream_readable.js +1 -1
- package/node_modules/readable-stream/lib/_stream_transform.js +1 -1
- package/node_modules/readable-stream/lib/_stream_writable.js +1 -1
- package/node_modules/readable-stream/package.json +6 -6
- package/node_modules/rimraf/package.json +2 -2
- package/node_modules/safe-buffer/package.json +1 -1
- package/node_modules/safer-buffer/package.json +1 -1
- package/node_modules/sax/package.json +1 -1
- package/node_modules/semver/package.json +2 -2
- package/node_modules/set-blocking/package.json +1 -1
- package/node_modules/signal-exit/package.json +1 -1
- package/node_modules/string-width/package.json +1 -1
- package/node_modules/string_decoder/package.json +1 -1
- package/node_modules/strip-ansi/package.json +1 -1
- package/node_modules/strip-json-comments/package.json +1 -1
- package/node_modules/tar/package.json +1 -1
- package/node_modules/util-deprecate/package.json +1 -1
- package/node_modules/wide-align/package.json +1 -1
- package/node_modules/wrappy/package.json +1 -1
- package/node_modules/yallist/package.json +1 -1
- package/package.json +2 -2
- package/node_modules/mkdirp/.travis.yml +0 -8
- package/node_modules/mkdirp/examples/pow.js +0 -6
- package/node_modules/mkdirp/test/chmod.js +0 -41
- package/node_modules/mkdirp/test/clobber.js +0 -38
- package/node_modules/mkdirp/test/mkdirp.js +0 -28
- package/node_modules/mkdirp/test/opts_fs.js +0 -29
- package/node_modules/mkdirp/test/opts_fs_sync.js +0 -27
- package/node_modules/mkdirp/test/perm.js +0 -32
- package/node_modules/mkdirp/test/perm_sync.js +0 -36
- package/node_modules/mkdirp/test/race.js +0 -37
- package/node_modules/mkdirp/test/rel.js +0 -32
- package/node_modules/mkdirp/test/return.js +0 -25
- package/node_modules/mkdirp/test/return_sync.js +0 -24
- package/node_modules/mkdirp/test/root.js +0 -19
- package/node_modules/mkdirp/test/sync.js +0 -32
- package/node_modules/mkdirp/test/umask.js +0 -28
- package/node_modules/mkdirp/test/umask_sync.js +0 -32
- package/node_modules/nopt/.npmignore +0 -1
- package/node_modules/nopt/.travis.yml +0 -8
- package/node_modules/nopt/examples/my-program.js +0 -30
- package/node_modules/nopt/test/basic.js +0 -303
- package/node_modules/rc/node_modules/minimist/.travis.yml +0 -8
- package/node_modules/rc/node_modules/minimist/LICENSE +0 -18
- package/node_modules/rc/node_modules/minimist/example/parse.js +0 -2
- package/node_modules/rc/node_modules/minimist/index.js +0 -236
- package/node_modules/rc/node_modules/minimist/package.json +0 -73
- package/node_modules/rc/node_modules/minimist/readme.markdown +0 -91
- package/node_modules/rc/node_modules/minimist/test/dash.js +0 -31
- package/node_modules/rc/node_modules/minimist/test/default_bool.js +0 -35
- package/node_modules/rc/node_modules/minimist/test/dotted.js +0 -22
- package/node_modules/rc/node_modules/minimist/test/long.js +0 -31
- package/node_modules/rc/node_modules/minimist/test/parse.js +0 -197
- package/node_modules/rc/node_modules/minimist/test/parse_modified.js +0 -9
- package/node_modules/rc/node_modules/minimist/test/short.js +0 -67
- package/node_modules/rc/node_modules/minimist/test/whitespace.js +0 -8
@@ -1,236 +0,0 @@
|
|
1
|
-
module.exports = function (args, opts) {
|
2
|
-
if (!opts) opts = {};
|
3
|
-
|
4
|
-
var flags = { bools : {}, strings : {}, unknownFn: null };
|
5
|
-
|
6
|
-
if (typeof opts['unknown'] === 'function') {
|
7
|
-
flags.unknownFn = opts['unknown'];
|
8
|
-
}
|
9
|
-
|
10
|
-
if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
|
11
|
-
flags.allBools = true;
|
12
|
-
} else {
|
13
|
-
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
|
14
|
-
flags.bools[key] = true;
|
15
|
-
});
|
16
|
-
}
|
17
|
-
|
18
|
-
var aliases = {};
|
19
|
-
Object.keys(opts.alias || {}).forEach(function (key) {
|
20
|
-
aliases[key] = [].concat(opts.alias[key]);
|
21
|
-
aliases[key].forEach(function (x) {
|
22
|
-
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
23
|
-
return x !== y;
|
24
|
-
}));
|
25
|
-
});
|
26
|
-
});
|
27
|
-
|
28
|
-
[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
29
|
-
flags.strings[key] = true;
|
30
|
-
if (aliases[key]) {
|
31
|
-
flags.strings[aliases[key]] = true;
|
32
|
-
}
|
33
|
-
});
|
34
|
-
|
35
|
-
var defaults = opts['default'] || {};
|
36
|
-
|
37
|
-
var argv = { _ : [] };
|
38
|
-
Object.keys(flags.bools).forEach(function (key) {
|
39
|
-
setArg(key, defaults[key] === undefined ? false : defaults[key]);
|
40
|
-
});
|
41
|
-
|
42
|
-
var notFlags = [];
|
43
|
-
|
44
|
-
if (args.indexOf('--') !== -1) {
|
45
|
-
notFlags = args.slice(args.indexOf('--')+1);
|
46
|
-
args = args.slice(0, args.indexOf('--'));
|
47
|
-
}
|
48
|
-
|
49
|
-
function argDefined(key, arg) {
|
50
|
-
return (flags.allBools && /^--[^=]+$/.test(arg)) ||
|
51
|
-
flags.strings[key] || flags.bools[key] || aliases[key];
|
52
|
-
}
|
53
|
-
|
54
|
-
function setArg (key, val, arg) {
|
55
|
-
if (arg && flags.unknownFn && !argDefined(key, arg)) {
|
56
|
-
if (flags.unknownFn(arg) === false) return;
|
57
|
-
}
|
58
|
-
|
59
|
-
var value = !flags.strings[key] && isNumber(val)
|
60
|
-
? Number(val) : val
|
61
|
-
;
|
62
|
-
setKey(argv, key.split('.'), value);
|
63
|
-
|
64
|
-
(aliases[key] || []).forEach(function (x) {
|
65
|
-
setKey(argv, x.split('.'), value);
|
66
|
-
});
|
67
|
-
}
|
68
|
-
|
69
|
-
function setKey (obj, keys, value) {
|
70
|
-
var o = obj;
|
71
|
-
keys.slice(0,-1).forEach(function (key) {
|
72
|
-
if (o[key] === undefined) o[key] = {};
|
73
|
-
o = o[key];
|
74
|
-
});
|
75
|
-
|
76
|
-
var key = keys[keys.length - 1];
|
77
|
-
if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
|
78
|
-
o[key] = value;
|
79
|
-
}
|
80
|
-
else if (Array.isArray(o[key])) {
|
81
|
-
o[key].push(value);
|
82
|
-
}
|
83
|
-
else {
|
84
|
-
o[key] = [ o[key], value ];
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
function aliasIsBoolean(key) {
|
89
|
-
return aliases[key].some(function (x) {
|
90
|
-
return flags.bools[x];
|
91
|
-
});
|
92
|
-
}
|
93
|
-
|
94
|
-
for (var i = 0; i < args.length; i++) {
|
95
|
-
var arg = args[i];
|
96
|
-
|
97
|
-
if (/^--.+=/.test(arg)) {
|
98
|
-
// Using [\s\S] instead of . because js doesn't support the
|
99
|
-
// 'dotall' regex modifier. See:
|
100
|
-
// http://stackoverflow.com/a/1068308/13216
|
101
|
-
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
102
|
-
var key = m[1];
|
103
|
-
var value = m[2];
|
104
|
-
if (flags.bools[key]) {
|
105
|
-
value = value !== 'false';
|
106
|
-
}
|
107
|
-
setArg(key, value, arg);
|
108
|
-
}
|
109
|
-
else if (/^--no-.+/.test(arg)) {
|
110
|
-
var key = arg.match(/^--no-(.+)/)[1];
|
111
|
-
setArg(key, false, arg);
|
112
|
-
}
|
113
|
-
else if (/^--.+/.test(arg)) {
|
114
|
-
var key = arg.match(/^--(.+)/)[1];
|
115
|
-
var next = args[i + 1];
|
116
|
-
if (next !== undefined && !/^-/.test(next)
|
117
|
-
&& !flags.bools[key]
|
118
|
-
&& !flags.allBools
|
119
|
-
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
120
|
-
setArg(key, next, arg);
|
121
|
-
i++;
|
122
|
-
}
|
123
|
-
else if (/^(true|false)$/.test(next)) {
|
124
|
-
setArg(key, next === 'true', arg);
|
125
|
-
i++;
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
setArg(key, flags.strings[key] ? '' : true, arg);
|
129
|
-
}
|
130
|
-
}
|
131
|
-
else if (/^-[^-]+/.test(arg)) {
|
132
|
-
var letters = arg.slice(1,-1).split('');
|
133
|
-
|
134
|
-
var broken = false;
|
135
|
-
for (var j = 0; j < letters.length; j++) {
|
136
|
-
var next = arg.slice(j+2);
|
137
|
-
|
138
|
-
if (next === '-') {
|
139
|
-
setArg(letters[j], next, arg)
|
140
|
-
continue;
|
141
|
-
}
|
142
|
-
|
143
|
-
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
144
|
-
setArg(letters[j], next.split('=')[1], arg);
|
145
|
-
broken = true;
|
146
|
-
break;
|
147
|
-
}
|
148
|
-
|
149
|
-
if (/[A-Za-z]/.test(letters[j])
|
150
|
-
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
151
|
-
setArg(letters[j], next, arg);
|
152
|
-
broken = true;
|
153
|
-
break;
|
154
|
-
}
|
155
|
-
|
156
|
-
if (letters[j+1] && letters[j+1].match(/\W/)) {
|
157
|
-
setArg(letters[j], arg.slice(j+2), arg);
|
158
|
-
broken = true;
|
159
|
-
break;
|
160
|
-
}
|
161
|
-
else {
|
162
|
-
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
|
-
var key = arg.slice(-1)[0];
|
167
|
-
if (!broken && key !== '-') {
|
168
|
-
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
|
169
|
-
&& !flags.bools[key]
|
170
|
-
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
171
|
-
setArg(key, args[i+1], arg);
|
172
|
-
i++;
|
173
|
-
}
|
174
|
-
else if (args[i+1] && /true|false/.test(args[i+1])) {
|
175
|
-
setArg(key, args[i+1] === 'true', arg);
|
176
|
-
i++;
|
177
|
-
}
|
178
|
-
else {
|
179
|
-
setArg(key, flags.strings[key] ? '' : true, arg);
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
else {
|
184
|
-
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
185
|
-
argv._.push(
|
186
|
-
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
|
187
|
-
);
|
188
|
-
}
|
189
|
-
if (opts.stopEarly) {
|
190
|
-
argv._.push.apply(argv._, args.slice(i + 1));
|
191
|
-
break;
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}
|
195
|
-
|
196
|
-
Object.keys(defaults).forEach(function (key) {
|
197
|
-
if (!hasKey(argv, key.split('.'))) {
|
198
|
-
setKey(argv, key.split('.'), defaults[key]);
|
199
|
-
|
200
|
-
(aliases[key] || []).forEach(function (x) {
|
201
|
-
setKey(argv, x.split('.'), defaults[key]);
|
202
|
-
});
|
203
|
-
}
|
204
|
-
});
|
205
|
-
|
206
|
-
if (opts['--']) {
|
207
|
-
argv['--'] = new Array();
|
208
|
-
notFlags.forEach(function(key) {
|
209
|
-
argv['--'].push(key);
|
210
|
-
});
|
211
|
-
}
|
212
|
-
else {
|
213
|
-
notFlags.forEach(function(key) {
|
214
|
-
argv._.push(key);
|
215
|
-
});
|
216
|
-
}
|
217
|
-
|
218
|
-
return argv;
|
219
|
-
};
|
220
|
-
|
221
|
-
function hasKey (obj, keys) {
|
222
|
-
var o = obj;
|
223
|
-
keys.slice(0,-1).forEach(function (key) {
|
224
|
-
o = (o[key] || {});
|
225
|
-
});
|
226
|
-
|
227
|
-
var key = keys[keys.length - 1];
|
228
|
-
return key in o;
|
229
|
-
}
|
230
|
-
|
231
|
-
function isNumber (x) {
|
232
|
-
if (typeof x === 'number') return true;
|
233
|
-
if (/^0x[0-9a-f]+$/i.test(x)) return true;
|
234
|
-
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
235
|
-
}
|
236
|
-
|
@@ -1,73 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_from": "minimist@^1.2.0",
|
3
|
-
"_id": "minimist@1.2.0",
|
4
|
-
"_inBundle": false,
|
5
|
-
"_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
6
|
-
"_location": "/rc/minimist",
|
7
|
-
"_phantomChildren": {},
|
8
|
-
"_requested": {
|
9
|
-
"type": "range",
|
10
|
-
"registry": true,
|
11
|
-
"raw": "minimist@^1.2.0",
|
12
|
-
"name": "minimist",
|
13
|
-
"escapedName": "minimist",
|
14
|
-
"rawSpec": "^1.2.0",
|
15
|
-
"saveSpec": null,
|
16
|
-
"fetchSpec": "^1.2.0"
|
17
|
-
},
|
18
|
-
"_requiredBy": [
|
19
|
-
"/rc"
|
20
|
-
],
|
21
|
-
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
22
|
-
"_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
|
23
|
-
"_spec": "minimist@^1.2.0",
|
24
|
-
"_where": "/Users/pipobscure/fsevents/node_modules/rc",
|
25
|
-
"author": {
|
26
|
-
"name": "James Halliday",
|
27
|
-
"email": "mail@substack.net",
|
28
|
-
"url": "http://substack.net"
|
29
|
-
},
|
30
|
-
"bugs": {
|
31
|
-
"url": "https://github.com/substack/minimist/issues"
|
32
|
-
},
|
33
|
-
"bundleDependencies": false,
|
34
|
-
"deprecated": false,
|
35
|
-
"description": "parse argument options",
|
36
|
-
"devDependencies": {
|
37
|
-
"covert": "^1.0.0",
|
38
|
-
"tap": "~0.4.0",
|
39
|
-
"tape": "^3.5.0"
|
40
|
-
},
|
41
|
-
"homepage": "https://github.com/substack/minimist",
|
42
|
-
"keywords": [
|
43
|
-
"argv",
|
44
|
-
"getopt",
|
45
|
-
"parser",
|
46
|
-
"optimist"
|
47
|
-
],
|
48
|
-
"license": "MIT",
|
49
|
-
"main": "index.js",
|
50
|
-
"name": "minimist",
|
51
|
-
"repository": {
|
52
|
-
"type": "git",
|
53
|
-
"url": "git://github.com/substack/minimist.git"
|
54
|
-
},
|
55
|
-
"scripts": {
|
56
|
-
"coverage": "covert test/*.js",
|
57
|
-
"test": "tap test/*.js"
|
58
|
-
},
|
59
|
-
"testling": {
|
60
|
-
"files": "test/*.js",
|
61
|
-
"browsers": [
|
62
|
-
"ie/6..latest",
|
63
|
-
"ff/5",
|
64
|
-
"firefox/latest",
|
65
|
-
"chrome/10",
|
66
|
-
"chrome/latest",
|
67
|
-
"safari/5.1",
|
68
|
-
"safari/latest",
|
69
|
-
"opera/12"
|
70
|
-
]
|
71
|
-
},
|
72
|
-
"version": "1.2.0"
|
73
|
-
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# minimist
|
2
|
-
|
3
|
-
parse argument options
|
4
|
-
|
5
|
-
This module is the guts of optimist's argument parser without all the
|
6
|
-
fanciful decoration.
|
7
|
-
|
8
|
-
[](http://ci.testling.com/substack/minimist)
|
9
|
-
|
10
|
-
[](http://travis-ci.org/substack/minimist)
|
11
|
-
|
12
|
-
# example
|
13
|
-
|
14
|
-
``` js
|
15
|
-
var argv = require('minimist')(process.argv.slice(2));
|
16
|
-
console.dir(argv);
|
17
|
-
```
|
18
|
-
|
19
|
-
```
|
20
|
-
$ node example/parse.js -a beep -b boop
|
21
|
-
{ _: [], a: 'beep', b: 'boop' }
|
22
|
-
```
|
23
|
-
|
24
|
-
```
|
25
|
-
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
|
26
|
-
{ _: [ 'foo', 'bar', 'baz' ],
|
27
|
-
x: 3,
|
28
|
-
y: 4,
|
29
|
-
n: 5,
|
30
|
-
a: true,
|
31
|
-
b: true,
|
32
|
-
c: true,
|
33
|
-
beep: 'boop' }
|
34
|
-
```
|
35
|
-
|
36
|
-
# methods
|
37
|
-
|
38
|
-
``` js
|
39
|
-
var parseArgs = require('minimist')
|
40
|
-
```
|
41
|
-
|
42
|
-
## var argv = parseArgs(args, opts={})
|
43
|
-
|
44
|
-
Return an argument object `argv` populated with the array arguments from `args`.
|
45
|
-
|
46
|
-
`argv._` contains all the arguments that didn't have an option associated with
|
47
|
-
them.
|
48
|
-
|
49
|
-
Numeric-looking arguments will be returned as numbers unless `opts.string` or
|
50
|
-
`opts.boolean` is set for that argument name.
|
51
|
-
|
52
|
-
Any arguments after `'--'` will not be parsed and will end up in `argv._`.
|
53
|
-
|
54
|
-
options can be:
|
55
|
-
|
56
|
-
* `opts.string` - a string or array of strings argument names to always treat as
|
57
|
-
strings
|
58
|
-
* `opts.boolean` - a boolean, string or array of strings to always treat as
|
59
|
-
booleans. if `true` will treat all double hyphenated arguments without equal signs
|
60
|
-
as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
|
61
|
-
* `opts.alias` - an object mapping string names to strings or arrays of string
|
62
|
-
argument names to use as aliases
|
63
|
-
* `opts.default` - an object mapping string argument names to default values
|
64
|
-
* `opts.stopEarly` - when true, populate `argv._` with everything after the
|
65
|
-
first non-option
|
66
|
-
* `opts['--']` - when true, populate `argv._` with everything before the `--`
|
67
|
-
and `argv['--']` with everything after the `--`. Here's an example:
|
68
|
-
* `opts.unknown` - a function which is invoked with a command line parameter not
|
69
|
-
defined in the `opts` configuration object. If the function returns `false`, the
|
70
|
-
unknown option is not added to `argv`.
|
71
|
-
|
72
|
-
```
|
73
|
-
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
|
74
|
-
{ _: [ 'one', 'two', 'three' ],
|
75
|
-
'--': [ 'four', 'five', '--six' ] }
|
76
|
-
```
|
77
|
-
|
78
|
-
Note that with `opts['--']` set, parsing for arguments still stops after the
|
79
|
-
`--`.
|
80
|
-
|
81
|
-
# install
|
82
|
-
|
83
|
-
With [npm](https://npmjs.org) do:
|
84
|
-
|
85
|
-
```
|
86
|
-
npm install minimist
|
87
|
-
```
|
88
|
-
|
89
|
-
# license
|
90
|
-
|
91
|
-
MIT
|
@@ -1,31 +0,0 @@
|
|
1
|
-
var parse = require('../');
|
2
|
-
var test = require('tape');
|
3
|
-
|
4
|
-
test('-', function (t) {
|
5
|
-
t.plan(5);
|
6
|
-
t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
|
7
|
-
t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
|
8
|
-
t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
|
9
|
-
t.deepEqual(
|
10
|
-
parse([ '-b', '-' ], { boolean: 'b' }),
|
11
|
-
{ b: true, _: [ '-' ] }
|
12
|
-
);
|
13
|
-
t.deepEqual(
|
14
|
-
parse([ '-s', '-' ], { string: 's' }),
|
15
|
-
{ s: '-', _: [] }
|
16
|
-
);
|
17
|
-
});
|
18
|
-
|
19
|
-
test('-a -- b', function (t) {
|
20
|
-
t.plan(3);
|
21
|
-
t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
22
|
-
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
23
|
-
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
|
24
|
-
});
|
25
|
-
|
26
|
-
test('move arguments after the -- into their own `--` array', function(t) {
|
27
|
-
t.plan(1);
|
28
|
-
t.deepEqual(
|
29
|
-
parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
|
30
|
-
{ name: 'John', _: [ 'before' ], '--': [ 'after' ] });
|
31
|
-
});
|
@@ -1,35 +0,0 @@
|
|
1
|
-
var test = require('tape');
|
2
|
-
var parse = require('../');
|
3
|
-
|
4
|
-
test('boolean default true', function (t) {
|
5
|
-
var argv = parse([], {
|
6
|
-
boolean: 'sometrue',
|
7
|
-
default: { sometrue: true }
|
8
|
-
});
|
9
|
-
t.equal(argv.sometrue, true);
|
10
|
-
t.end();
|
11
|
-
});
|
12
|
-
|
13
|
-
test('boolean default false', function (t) {
|
14
|
-
var argv = parse([], {
|
15
|
-
boolean: 'somefalse',
|
16
|
-
default: { somefalse: false }
|
17
|
-
});
|
18
|
-
t.equal(argv.somefalse, false);
|
19
|
-
t.end();
|
20
|
-
});
|
21
|
-
|
22
|
-
test('boolean default to null', function (t) {
|
23
|
-
var argv = parse([], {
|
24
|
-
boolean: 'maybe',
|
25
|
-
default: { maybe: null }
|
26
|
-
});
|
27
|
-
t.equal(argv.maybe, null);
|
28
|
-
var argv = parse(['--maybe'], {
|
29
|
-
boolean: 'maybe',
|
30
|
-
default: { maybe: null }
|
31
|
-
});
|
32
|
-
t.equal(argv.maybe, true);
|
33
|
-
t.end();
|
34
|
-
|
35
|
-
})
|
@@ -1,22 +0,0 @@
|
|
1
|
-
var parse = require('../');
|
2
|
-
var test = require('tape');
|
3
|
-
|
4
|
-
test('dotted alias', function (t) {
|
5
|
-
var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
6
|
-
t.equal(argv.a.b, 22);
|
7
|
-
t.equal(argv.aa.bb, 22);
|
8
|
-
t.end();
|
9
|
-
});
|
10
|
-
|
11
|
-
test('dotted default', function (t) {
|
12
|
-
var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
13
|
-
t.equal(argv.a.b, 11);
|
14
|
-
t.equal(argv.aa.bb, 11);
|
15
|
-
t.end();
|
16
|
-
});
|
17
|
-
|
18
|
-
test('dotted default with no alias', function (t) {
|
19
|
-
var argv = parse('', {default: {'a.b': 11}});
|
20
|
-
t.equal(argv.a.b, 11);
|
21
|
-
t.end();
|
22
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
var test = require('tape');
|
2
|
-
var parse = require('../');
|
3
|
-
|
4
|
-
test('long opts', function (t) {
|
5
|
-
t.deepEqual(
|
6
|
-
parse([ '--bool' ]),
|
7
|
-
{ bool : true, _ : [] },
|
8
|
-
'long boolean'
|
9
|
-
);
|
10
|
-
t.deepEqual(
|
11
|
-
parse([ '--pow', 'xixxle' ]),
|
12
|
-
{ pow : 'xixxle', _ : [] },
|
13
|
-
'long capture sp'
|
14
|
-
);
|
15
|
-
t.deepEqual(
|
16
|
-
parse([ '--pow=xixxle' ]),
|
17
|
-
{ pow : 'xixxle', _ : [] },
|
18
|
-
'long capture eq'
|
19
|
-
);
|
20
|
-
t.deepEqual(
|
21
|
-
parse([ '--host', 'localhost', '--port', '555' ]),
|
22
|
-
{ host : 'localhost', port : 555, _ : [] },
|
23
|
-
'long captures sp'
|
24
|
-
);
|
25
|
-
t.deepEqual(
|
26
|
-
parse([ '--host=localhost', '--port=555' ]),
|
27
|
-
{ host : 'localhost', port : 555, _ : [] },
|
28
|
-
'long captures eq'
|
29
|
-
);
|
30
|
-
t.end();
|
31
|
-
});
|