Skip to content

restrict the number of allowed options/strict mode #37

Open
@tttp

Description

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,

  1. it would be nice to have to have a second parameter "type" on unknown (ie "-" "--" "" if alias, normal, or argv.)
  2. 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+

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions