Skip to content

Commit 98f1f5f

Browse files
committed
1 parent 8710ff8 commit 98f1f5f

File tree

8 files changed

+179
-159
lines changed

8 files changed

+179
-159
lines changed

node_modules/nopt/bin/nopt.js

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env node
2-
var nopt = require('../lib/nopt')
3-
var path = require('path')
4-
var types = { num: Number,
2+
const nopt = require('../lib/nopt')
3+
const path = require('path')
4+
console.log('parsed', nopt({
5+
num: Number,
56
bool: Boolean,
67
help: Boolean,
78
list: Array,
@@ -13,8 +14,8 @@ var types = { num: Number,
1314
config: Boolean,
1415
length: Number,
1516
file: path,
16-
}
17-
var shorthands = { s: ['--str', 'astring'],
17+
}, {
18+
s: ['--str', 'astring'],
1819
b: ['--bool'],
1920
nb: ['--no-bool'],
2021
tft: ['--bool-list', '--no-bool-list', '--bool-list', 'true'],
@@ -25,32 +26,4 @@ var shorthands = { s: ['--str', 'astring'],
2526
c: ['--config'],
2627
l: ['--length'],
2728
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-
}
29+
}, process.argv, 2))

node_modules/nopt/lib/debug.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* istanbul ignore next */
22
module.exports = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
3-
? function () {
4-
console.error.apply(console, arguments)
5-
}
6-
: function () {}
3+
? (...a) => console.error(...a)
4+
: () => {}

0 commit comments

Comments
 (0)