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

Don't show (default: true) for negated option #37

Open
egoist opened this issue Dec 2, 2018 · 4 comments
Open

Don't show (default: true) for negated option #37

egoist opened this issue Dec 2, 2018 · 4 comments

Comments

@egoist
Copy link
Collaborator

egoist commented Dec 2, 2018

--no-clean Don't clean output directory (default: true)

This is misleading, you might think --no-clean is enabled by default.

@joaotavora
Copy link

In fact, what should IMO happen is if there is a negated option, it should be merged with the affirmative case in the help, using the [no-]foo syntax.

@egoist
Copy link
Collaborator Author

egoist commented Feb 18, 2021

@joaotavora: In fact, what should IMO happen is if there is a negated option, it should be merged with the affirmative case in the help, using the [no-]foo syntax.

that's a good idea.

@joaotavora
Copy link

interest in a PR?

@egoist
Copy link
Collaborator Author

egoist commented Feb 19, 2021

Sure 🤗

joaotavora added a commit to joaotavora/cac that referenced this issue Feb 19, 2021
Probably doesn't make any practical difference, since this is only
used for the Command array, but less lines of code :-)

* src/utils.ts (findLongest)
joaotavora added a commit to joaotavora/cac that referenced this issue Feb 19, 2021
Not only doesn't show the `(default: true)` for negated options, which
was quite confusing, but merges them with the line describing the
affirmative case.

Added a new test.  Since it relies on help output, it is a bit
brittle, like the other "snapshot"-based ones.  I didn't the same
execa snapshot for this because it would make a test take a lot longer
to run (becasue spawns a process).

* README.md (Options): Mention [no-]foo syntax.

* src/Command.ts (outputHelp): Consider options with negated
counterparts when printing.

* src/__test__/index.test.ts ('negated option help output'): New test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants