Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print --no-[arg] in usage text #176

Open
1 task done
BobbieGoede opened this issue Dec 18, 2024 · 1 comment · May be fixed by #177
Open
1 task done

print --no-[arg] in usage text #176

BobbieGoede opened this issue Dec 18, 2024 · 1 comment · May be fixed by #177
Labels
enhancement New feature or request

Comments

@BobbieGoede
Copy link

BobbieGoede commented Dec 18, 2024

Describe the feature

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?
@BobbieGoede BobbieGoede added the enhancement New feature or request label Dec 18, 2024
@pi0
Copy link
Member

pi0 commented Dec 18, 2024

Agree and I think it makes sense to print both --no-[arg] (new) + --arg in either two conditions for boolean args.

(if: arg does not begin with no itself to avoid collision with current usage)

  • default is true (it might lack description, that's fine)
  • negativeDescription is provided

PR welcome 👍🏼

@pi0 pi0 changed the title Default boolean arg usage consistency print --no-[arg] in usage text Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants