Skip to content

fix: added visible long flag aliases in help #6068

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GilShoshan94
Copy link
Contributor

fix #6067

@GilShoshan94
Copy link
Contributor Author

I will probably have to update the ui tests as well

@GilShoshan94
Copy link
Contributor Author

I updated the ui testes as well in a separated commit

@GilShoshan94
Copy link
Contributor Author

@epage
The PR is ready.

I added the visible long flag aliases, as well as in the debug and adapted the ui tests.
The only thing not strictly necessary I did is to rename in one closure a to s, because it was confusing as a is already the function argument (a: &Command)

@@ -9,9 +9,9 @@ Commands:
more
test Subcommand with one visible alias [aliases: do-stuff]
test_2 several visible aliases [aliases: do-other-stuff, tests]
test_3, --test several visible long flag aliases
test_3, --test several visible long flag aliases [aliases: --testing, --testall, --test_all]
Copy link
Member

Choose a reason for hiding this comment

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

The fact that no source changed in this commit suggests these commits are not atomic (tests should pass on every commit)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, ok, I will squash them together as one commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will wait for your answer about the commits order you want (in the other comment)

Copy link
Member

Choose a reason for hiding this comment

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

tests/builder/flag_subcommands.rs has a test for visible_short_flag_aliases, could you

  • Add a parallel test for long flag aliases?
  • Add a test for both for help output in tests/builder/help.rs?

Like normal, ideally new tests would be added in a commit before this one and would pass on that commit.

Copy link
Contributor Author

@GilShoshan94 GilShoshan94 Jul 10, 2025

Choose a reason for hiding this comment

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

@epage
Yes, I will add the tests, no problem.

I'm not sure I understand what you want with the commit/git history exactly.

From what I understand, you want:

  • 1st commit: add the tests for long_flag_aliases in tests/builder/flag_subcommands.rs and tests/builder/help.rs and fix the tests in UI ?
    This commit would result in a failed CI and that would be normal.

  • 2nd commit: add the fix in clap_builder/src/output/help_template.rs to shows the visible long flag aliases.
    This commit would pass the CI.

So in total 2 commits, one to fix and update the tests, the second to fix the source code.

Did I understand correctly?
Shall I do that?

Copy link
Member

Choose a reason for hiding this comment

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

Commit 1: Adds tests, cargo test should pass: this means the test shows the current behavior

Commit 2: Change behavior, update tests to reflect the change in behavior.

#5520 serves as an example of this

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.

Missing visible long flag aliases in help
2 participants