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

Items hidden in help are shown in markdown generation #18

Closed
leighmcculloch opened this issue Nov 27, 2023 · 1 comment · Fixed by #22
Closed

Items hidden in help are shown in markdown generation #18

leighmcculloch opened this issue Nov 27, 2023 · 1 comment · Fixed by #22

Comments

@leighmcculloch
Copy link

leighmcculloch commented Nov 27, 2023

It's possible to hide options in the clap help output with the #[arg(..., hide)] attribute. The attribute hides the flag/option in the help output.

clap-markdown still includes hidden options though, making it's output inconsistent with the clap help output.

@ilyagr
Copy link
Contributor

ilyagr commented Jan 28, 2024

#15 claims to fix this. I haven't looked at it carefully, but I think these should be linked.

ilyagr added a commit to jj-vcs/jj that referenced this issue Jan 30, 2024
This uses the [`clap-markdown`] library. It's not very flexible, but seems to
work. Its implementation is not difficult. If needed, we could later
reimplement the part that iterates over all subcommands and have a different
output (e.g., the boring version of each help text inside its own code block,
or a different file per subcommand, or some fancy template in handlebars or
another rust-supported templating language). I don't want to do it right now,
though.

The library does turn out to have some annoying bugs, e.g.
ConnorGray/clap-markdown#18, but I think that's not a
deal-braker.  The fix seems to be 3 lines; if the fix doesn't get merged soon, we
could vendor the library maybe?

[`clap-markdown`]: https://docs.rs/clap-markdown/latest/clap_markdown/
ilyagr added a commit to ilyagr/clap-markdown that referenced this issue Jun 13, 2024
ilyagr added a commit to ilyagr/clap-markdown that referenced this issue Jun 13, 2024
ilyagr added a commit to ilyagr/clap-markdown that referenced this issue Jun 13, 2024
ilyagr added a commit to ilyagr/clap-markdown that referenced this issue Jun 13, 2024
ilyagr added a commit to ilyagr/clap-markdown that referenced this issue Jun 14, 2024
ConnorGray added a commit that referenced this issue Jun 15, 2024
…n arguments (#22)

* Fix `cargo test`: it failed before this commit

* Do not print true, false options for flags

The user cannot write `--list false` for a flag.

Fixes #19.

* Do not show hidden arguments

Fixes #18

* A very minor refactor

It snuck into a previous version of this PR; I can take it out, but it
seems like a mild improvement.

* integration: Keep `write!` at top of function for readability

---------

Co-authored-by: Connor Gray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants