Comparing version 0.3.0 to 0.3.1
@@ -205,2 +205,36 @@ // src/cli/main.ts | ||
// src/cli/help.ts | ||
const help_text = ` | ||
pkg-fence | ||
Reading the NPM lockfile from stdin and filtering pkg name by rules. | ||
Exit code: 0 for empty results, 1 for anything matched. | ||
Usage: | ||
cat package-lock.json | pkg-fence <cmd> | ||
npm shrinkwrap && cat npm-shrinkwrap.json | pkg-fence <cmd> | ||
Builtin Presets: | ||
--lodash | ||
--nolyfill | ||
Options: | ||
--extra foo --extra bar --extra=abc,def | ||
--ignore foo --ignore bar --ignore=abc,def | ||
`; | ||
// src/cli/main.ts | ||
@@ -232,7 +266,16 @@ function parse(args) { | ||
args = argv.slice(2), | ||
lines = createInterface(stdin), | ||
input = stdin, | ||
lines: optional_lines, | ||
print = console.log, | ||
quit = exit | ||
} = {}) { | ||
{ | ||
const [cmd] = Array.from(args); | ||
if (cmd == null || cmd === "-h" || cmd === "--help") { | ||
print(help_text); | ||
return quit(0); | ||
} | ||
} | ||
const flags = parse(args); | ||
const lines = optional_lines ?? createInterface({ input }); | ||
let code = 0; | ||
@@ -239,0 +282,0 @@ for await (const pkg of collect({ flags, lines })) { |
{ | ||
"name": "pkg-fence", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "tbd", | ||
@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only", |
41497
267