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
Generated man pages still claim that flag options take values #4443
Comments
The man generation would generate suggestions for all options of values they should take, even if the argument did not take values. This adds a simple check to make sure only options that take values offer a suggestion fixes: clap-rs#4443
The man generation would generate suggestions for all options of values they should take, even if the argument did not take values. This adds a simple check to make sure only options that take values offer a suggestion fixes: clap-rs#4443
As pointed out in #4506, #4432 highlights output where this is working and we have tests highlighting this working. @Calder-Ty pointed out regarding #4506
|
I want to clarify that it is the proposed change in #4506 that brought a fix for the given examples above. However as pointed out, in the PR the change doesn't affect existing tests, which we should expect it to. I'm still trying to dig up what changed between #4432 and now, as i'm able to replicate the issue in the report. |
The one big difference I notice this Issue is using the derive API and the existing tests are using the builder API. Since #4506 fixes this, it implies that a value name is being set for flags in the derive. It looks like we always set value_name in the derive: https://github.com/clap-rs/clap/blob/master/clap_derive/src/derives/args.rs#L232 Normally, we verify the relationship between num_args and value_names but apparently we skip it for empty value names to make the derive easier: https://github.com/clap-rs/clap/blob/master/src/builder/debug_asserts.rs#L757 So the question is if we should fix this in the derive or in the callers. I will point out that clap_mangen is a bit simple in its rendering of values; |
One option would be for us to expose an If someone wants to step up and write the ansi to roff converter as I won't be getting to it immediately, that'd be great. I have notes to help prepare for it in the issues at https://github.com/epage/anstyle/issues. However, that is a big ask and people likely don't want to wait that long. I can understand just duplicating the code into clap_mangen until then. |
@epage, I don't mind working getting a workaround you describe setup for now. I don't know if i'm up to the ANSI conversion, would have to look into that more. |
It was noticed that between clap-rs#4443 and clap-rs#4432, an issue in the behavior was that the derive api handles tasks with values slightly differently than the declarative api. Added a test to show parity between declaritive and derive api.
It was noticed that between clap-rs#4443 and clap-rs#4432, an issue in the behavior was that the derive api handles tasks with values slightly differently than the declarative api. Added a test to show parity between declaritive and derive api.
It was noticed that between clap-rs#4443 and clap-rs#4432, an issue in the behavior was that the derive api handles tasks with values slightly differently than the declarative api. Added a test to show parity between declaritive and derive api.
It was noticed that between clap-rs#4443 and clap-rs#4432, an issue in the behavior was that the derive api handles tasks with values slightly differently than the declarative api. Added a test to show parity between declaritive and derive api.
It was noticed that between clap-rs#4443 and clap-rs#4432, an issue in the behavior was that the derive api handles tasks with values slightly differently than the declarative api. Added a test to show parity between declaritive and derive api.
@epage Sorry for leaving this alone for so long. I've been looking into ways to make a quick workaround Adding an Arg::Render function is feasible, but it also generates styles that would be noticeably different Copying the code into clap_mangen is a lot of reduplication, as there are a lot of private dependencies I wouldn't mind working on writing an ANSI to Roff converter, but I would like to have As an aside, when testing these different API's I found some other cosmetic disparities between |
In https://github.com/epage/anstyle/issues/4, I contrast different ANSI parsing libraries. For a first round, feel free to use what is easiest as long as it as a good license. I'm less concerned about anstyle is where I'm housing these different integrations, e.g. you can see what it supports today in the README.
|
Pending the broader refactor, I've submitted a localized fix in #4645. |
Please complete the following tasks
Rust Version
rustc 1.64.0 (Fedora 1.64.0-1.fc36)
Clap Version
4.0.18, clap_mangen 0.2.4
Minimal reproducible code
Cargo.toml:
Steps to reproduce the bug with the above code
cargo run | man -l -
Actual Behaviour
The option description for
--thing
claims that it takes an argument:It doesn't:
Expected Behaviour
The man page lists the option without any argument, as it did in clap 3.2 / clap_mangen 0.1:
Additional Context
This is a followup to #4410. clap_mangen 0.2.4 improved the situation but didn't fix it.
Debug Output
No response
The text was updated successfully, but these errors were encountered: