You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining a boolean argument (e.g. --arg) that is enabled by default we currently print --no-arg usage.
I have some suggestions on this:
Only print --no-arg usage if negativeDescription is defined
While making changes to nuxt/cli I found it confusing that --no-arg is printed while the description described what happens if true is passed.
This can be made more explicit by only printing the --no-arg when a negativeDescription is defined, I realize this property was a later addition.
Always print both --arg and --no-arg
Printing both the normal usage and the negative usage (perhaps indented/nested) communicates to the end user that this is the same argument, it will be easier to find in the source code as well.
Only print aliases for the defined command (no negative aliases)
Not sure if intentional but the printed usage also applies the negative prefixes to defined aliases, this can look odd if an alias is a single character (e.g. -p, --production becomes --no-p, --no-production).
Personally I view the negative arguments as a kind of alias already, having negative versions of the aliases seems to go beyond convenience.
Removed last point, should be separate issue (out of scope for this issue)
Maybe the current behavior is as intended/desired, let me know! If not, I would be happy to help make implement the suggestions.
Additional information
Would you be willing to help implement this feature?
Activity
pi0 commentedon Dec 18, 2024
Agree and I think it makes sense to print both
--no-[arg](new) +--argin either two conditions for boolean args.(if: arg does not begin with
noitself to avoid collision with current usage)true(it might lack description, that's fine)negativeDescriptionis providedPR welcome 👍🏼
[-]Default boolean arg usage consistency[/-][+]print `--no-[arg]` in usage text[/+]ericc-ch commentedon Jan 9, 2025
Yes I think this would help. I recently tried adding a boolean argument manually, prefixed with --no, and it wouldn't be parsed correctly.
In my case the value will always be parsed as false even if --no-download is present
Fix to not use "no-" prefix in options
Fix to not use "no-" prefix in options (#1121)