From 7e24ad394f9ca4c1b841f02e5d4641c15af5c676 Mon Sep 17 00:00:00 2001 From: hiroki osame Date: Sat, 29 Jan 2022 12:42:11 -0500 Subject: [PATCH] feat: support eof in parameters (#7) --- README.md | 32 ++++++++ examples/npm/commands/run-script.ts | 18 +++++ examples/npm/index.ts | 2 + src/cli.ts | 101 +++++++++++++++++------- src/render-help/generate-help.ts | 14 +++- tests/__snapshots__/help.spec.ts.snap | 27 +++++++ tests/arguments.spec.ts | 108 ++++++++++++++++++++++++++ tests/help.spec.ts | 52 +++++++++++++ 8 files changed, 327 insertions(+), 27 deletions(-) create mode 100644 examples/npm/commands/run-script.ts diff --git a/README.md b/README.md index c6d02a0..4313987 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,38 @@ argv._.optionalParameter // => "b" (string | undefined) argv._.optionalSpread // => ["c", "d"] (string[]) ``` +#### End-of-flags +End-of-flags (`--`) (aka _end-of-options_) allows users to pass in a subset of arguments. This is useful for passing in arguments that should be parsed separately from the rest of the arguments or passing in arguments that look like flags. + +An example of this is [`npm run`](https://docs.npmjs.com/cli/v8/commands/npm-run-script): +```sh +$ npm run