Skip to content

Commit

Permalink
deps: nopt@7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jun 19, 2023
1 parent 8710ff8 commit 98f1f5f
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 159 deletions.
41 changes: 7 additions & 34 deletions node_modules/nopt/bin/nopt.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node
var nopt = require('../lib/nopt')
var path = require('path')
var types = { num: Number,
const nopt = require('../lib/nopt')
const path = require('path')
console.log('parsed', nopt({
num: Number,
bool: Boolean,
help: Boolean,
list: Array,
Expand All @@ -13,8 +14,8 @@ var types = { num: Number,
config: Boolean,
length: Number,
file: path,
}
var shorthands = { s: ['--str', 'astring'],
}, {
s: ['--str', 'astring'],
b: ['--bool'],
nb: ['--no-bool'],
tft: ['--bool-list', '--no-bool-list', '--bool-list', 'true'],
Expand All @@ -25,32 +26,4 @@ var shorthands = { s: ['--str', 'astring'],
c: ['--config'],
l: ['--length'],
f: ['--file'],
}
var parsed = nopt(types
, shorthands
, process.argv
, 2)

console.log('parsed', parsed)

if (parsed.help) {
console.log('')
console.log('nopt cli tester')
console.log('')
console.log('types')
console.log(Object.keys(types).map(function M (t) {
var type = types[t]
if (Array.isArray(type)) {
return [t, type.map(function (mappedType) {
return mappedType.name
})]
}
return [t, type && type.name]
}).reduce(function (s, i) {
s[i[0]] = i[1]
return s
}, {}))
console.log('')
console.log('shorthands')
console.log(shorthands)
}
}, process.argv, 2))
6 changes: 2 additions & 4 deletions node_modules/nopt/lib/debug.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* istanbul ignore next */
module.exports = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
? function () {
console.error.apply(console, arguments)
}
: function () {}
? (...a) => console.error(...a)
: () => {}
Loading

0 comments on commit 98f1f5f

Please sign in to comment.