Closed YHAMSTM closed 1 year ago
Related to #38.
I'm confused what you're asking for. The --no-x
behavior meaning --x=false
has been around a long time, and is pretty common in the ecosystem for boolean args. Can you elaborate on the exact arg input you want, and what parsed output you want to see?
Hello, Yes, I agree with you. However, for my use case, I'd like to use minimist for user input validation (associated with express validator) in order to have inputs for CLI calls. CLI in the backend requires to have the exact input associated to it without other interpretation.
I would like to have --no-x
resolving to no-x: true
instead of x: false
That's why I think it can be good (if you agree) to have an option to enable this transformation or not (by default it can stay true to not have any breaking changes)
Thanks for the extra detail. I think this is something you can do reasonably easily in user code, and not a common requirement. (I might be proved wrong by up votes though!)
I don't want to add configuration for all the variations of representing the options. For example, yargs-parser has a common heritage with Minimist and supports:
strip-aliased
strip-dashed
camel-case-expansion
boolean-negation
<-- this is the one that controls what you wantnegation-prefix
For comparison with another alternative, parseArgs
from node:util processes --no-foo
as no-foo
and has a strict mode. (Minimist does not have a strict mode, although we are thinking about it: #41)
Thanks for your replies and your advice.
Indeed, yargs-parser
looks like a perfect fit for my use case.
If its not a feature to be planned, I will close the issue
(Note: I am one of two maintainers and speaking for myself. Second opinion likely. 😄 )
Hello,
I'm opening this PR to know if we can have the ability to disable a part that catches an arg which starts with "no" and transform it into another string with value set to false. For my current wrapper, I would like to let the string with "no" and value to "true". I would see for example a new flag when calling minimist to disable transformation these/this transformation(s)
https://github.com/minimistjs/minimist/blob/fdbb909cf916b3bac9f76f6ee72c64e05b73c2d9/index.js#L169
Best regards, Yanis