restrict the number of allowed options/strict mode #37
Open
Description
opened on May 1, 2023
Hi,
I'm not sure what's the best place to discuss feature, feel free to close and direct me to a better place
Some users of our cli mistype an argument name (eg the cli expects --dry-run and they type --dryrun).
If would be useful to have a strict mode that stops the process if there is an unknown error
(eg. invalid parameter "dryrun")
I tried to implement it using unknown
unknown: (param) => {param[0] === '-' ? console.error("invalid parameter",param) || process.exit(1) : true},
however,
- it would be nice to have to have a second parameter "type" on unknown (ie "-" "--" "" if alias, normal, or argv.)
- I can't figure out how to handle valid params that are int (eg aren't listed into boolean or string), is there an "any" or "integer" option?
X+
Activity