Skip to content

Commit 66f9bcd

Browse files
committed
deps: nopt@7.0.0
1 parent 5730d17 commit 66f9bcd

File tree

13 files changed

+843
-20
lines changed

13 files changed

+843
-20
lines changed

node_modules/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@
170170
!/node-gyp/node_modules/make-fetch-happen
171171
!/node-gyp/node_modules/minimatch
172172
!/node-gyp/node_modules/minipass-fetch
173+
!/node-gyp/node_modules/nopt
173174
!/node-gyp/node_modules/npmlog
174175
!/node-gyp/node_modules/ssri
175176
!/node-gyp/node_modules/unique-filename
176177
!/node-gyp/node_modules/unique-slug
177178
!/node-gyp/node_modules/which
178179
!/nopt
180+
!/nopt/node_modules/
181+
/nopt/node_modules/*
182+
!/nopt/node_modules/abbrev
179183
!/normalize-package-data
180184
!/npm-audit-report
181185
!/npm-bundled
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The ISC License
2+
3+
Copyright (c) Isaac Z. Schlueter and Contributors
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env node
2+
var nopt = require('../lib/nopt')
3+
var path = require('path')
4+
var types = { num: Number,
5+
bool: Boolean,
6+
help: Boolean,
7+
list: Array,
8+
'num-list': [Number, Array],
9+
'str-list': [String, Array],
10+
'bool-list': [Boolean, Array],
11+
str: String,
12+
clear: Boolean,
13+
config: Boolean,
14+
length: Number,
15+
file: path,
16+
}
17+
var shorthands = { s: ['--str', 'astring'],
18+
b: ['--bool'],
19+
nb: ['--no-bool'],
20+
tft: ['--bool-list', '--no-bool-list', '--bool-list', 'true'],
21+
'?': ['--help'],
22+
h: ['--help'],
23+
H: ['--help'],
24+
n: ['--num', '125'],
25+
c: ['--config'],
26+
l: ['--length'],
27+
f: ['--file'],
28+
}
29+
var parsed = nopt(types
30+
, shorthands
31+
, process.argv
32+
, 2)
33+
34+
console.log('parsed', parsed)
35+
36+
if (parsed.help) {
37+
console.log('')
38+
console.log('nopt cli tester')
39+
console.log('')
40+
console.log('types')
41+
console.log(Object.keys(types).map(function M (t) {
42+
var type = types[t]
43+
if (Array.isArray(type)) {
44+
return [t, type.map(function (mappedType) {
45+
return mappedType.name
46+
})]
47+
}
48+
return [t, type && type.name]
49+
}).reduce(function (s, i) {
50+
s[i[0]] = i[1]
51+
return s
52+
}, {}))
53+
console.log('')
54+
console.log('shorthands')
55+
console.log(shorthands)
56+
}

0 commit comments

Comments
 (0)