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

Mangen no longer generates suggestions for options that don't take values #4506

Closed
wants to merge 2 commits into from

Conversation

Calder-Ty
Copy link
Contributor

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.

See examples in underlying issue.

fixes: #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
@@ -70,6 +70,13 @@ fn possible_values() {
common::assert_matches_path("tests/snapshots/possible_values.bash.roff", cmd);
}

#[test]
fn flag_without_value() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you verify the behavior of the test changed with clab_mangen changes? I see other tests using SetTrue but their snapshots didn't change, implying this PR didn't have an affect (see also my other comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see i was being too naive with the solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange because the change definitely does work on the example provided in the bug report

if let Some(value) = &opt.get_value_names() {
header.push(roman("="));
header.push(italic(&value.join(" ")));
if opt.get_action().takes_values() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems suspicious. #4432 showed working man pages. We should know what the difference is between the old issue and new issue and discuss it in this PRs issue for which route to go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Yeah i'll look at that.

@Calder-Ty Calder-Ty changed the title Mangen no longer generates suggestions for options that don't take values WIP: Mangen no longer generates suggestions for options that don't take values Nov 30, 2022
@Calder-Ty Calder-Ty force-pushed the man_gen/4443 branch 2 times, most recently from 9640297 to 330141c Compare November 30, 2022 04:10
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.
@Calder-Ty Calder-Ty changed the title WIP: Mangen no longer generates suggestions for options that don't take values Mangen no longer generates suggestions for options that don't take values Dec 16, 2022
@epage
Copy link
Member

epage commented Jan 3, 2023

@Calder-Ty whats the status of this PR?

@Calder-Ty
Copy link
Contributor Author

@epage I've been working on the anstyle-roff parser, and it has given me some new ideas on how to approach this differently. I'm okay with closing this PR and i can push a different one.

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 this pull request may close these issues.

Generated man pages still claim that flag options take values
2 participants