Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Nov 2, 2022
1 parent 5730d17 commit 66f9bcd
Show file tree
Hide file tree
Showing 13 changed files with 843 additions and 20 deletions.
4 changes: 4 additions & 0 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,16 @@
!/node-gyp/node_modules/make-fetch-happen
!/node-gyp/node_modules/minimatch
!/node-gyp/node_modules/minipass-fetch
!/node-gyp/node_modules/nopt
!/node-gyp/node_modules/npmlog
!/node-gyp/node_modules/ssri
!/node-gyp/node_modules/unique-filename
!/node-gyp/node_modules/unique-slug
!/node-gyp/node_modules/which
!/nopt
!/nopt/node_modules/
/nopt/node_modules/*
!/nopt/node_modules/abbrev
!/normalize-package-data
!/npm-audit-report
!/npm-bundled
Expand Down
15 changes: 15 additions & 0 deletions node_modules/node-gyp/node_modules/nopt/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
The ISC License

Copyright (c) Isaac Z. Schlueter and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
56 changes: 56 additions & 0 deletions node_modules/node-gyp/node_modules/nopt/bin/nopt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env node
var nopt = require('../lib/nopt')
var path = require('path')
var types = { num: Number,
bool: Boolean,
help: Boolean,
list: Array,
'num-list': [Number, Array],
'str-list': [String, Array],
'bool-list': [Boolean, Array],
str: String,
clear: Boolean,
config: Boolean,
length: Number,
file: path,
}
var shorthands = { s: ['--str', 'astring'],
b: ['--bool'],
nb: ['--no-bool'],
tft: ['--bool-list', '--no-bool-list', '--bool-list', 'true'],
'?': ['--help'],
h: ['--help'],
H: ['--help'],
n: ['--num', '125'],
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)
}
Loading

0 comments on commit 66f9bcd

Please sign in to comment.