From 47acab3e0d92eb36da8a1e59609069a076a821ee Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 13 Jun 2023 17:28:46 -0700 Subject: [PATCH] fix: remove unused bin --- bin/nopt.js | 56 ------------------------------------- docs/examples/my-program.js | 30 -------------------- package.json | 3 -- 3 files changed, 89 deletions(-) delete mode 100755 bin/nopt.js delete mode 100755 docs/examples/my-program.js diff --git a/bin/nopt.js b/bin/nopt.js deleted file mode 100755 index bb04291..0000000 --- a/bin/nopt.js +++ /dev/null @@ -1,56 +0,0 @@ -#!/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) -} diff --git a/docs/examples/my-program.js b/docs/examples/my-program.js deleted file mode 100755 index c9b32af..0000000 --- a/docs/examples/my-program.js +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env node - -// process.env.DEBUG_NOPT = 1 - -// my-program.js -var nopt = require('../lib/nopt') -var Stream = require('stream').Stream -var path = require('path') -var knownOpts = { foo: [String, null], - bar: [Stream, Number], - baz: path, - bloo: ['big', 'medium', 'small'], - flag: Boolean, - pick: Boolean, -} -var shortHands = { foofoo: ['--foo', 'Mr. Foo'], - b7: ['--bar', '7'], - m: ['--bloo', 'medium'], - p: ['--pick'], - f: ['--flag', 'true'], - g: ['--flag'], - s: '--flag', -} -// everything is optional. -// knownOpts and shorthands default to {} -// arg list defaults to process.argv -// slice defaults to 2 -var parsed = nopt(knownOpts, shortHands, process.argv, 2) - -console.log('parsed =\n' + require('util').inspect(parsed)) diff --git a/package.json b/package.json index fb6b4a4..c08043c 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,6 @@ "type": "git", "url": "https://github.com/npm/nopt.git" }, - "bin": { - "nopt": "bin/nopt.js" - }, "license": "ISC", "dependencies": { "abbrev": "^2.0.0"