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

feat(clap_complete): Support hiding long flags and their long aliases #5583

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

shannmu
Copy link
Contributor

@shannmu shannmu commented Jul 17, 2024

Based on PR: #5549
Related issue: #3951

Works in this PR

  • refactor: Add CompletionCandidate to replace (OsString, Option<StyledStr>). There will be a new field named visible for CompletionCandidate. If we don't need this struct, there will be a type (OsString, Option<StyledStr>, bool).
  • Support hiding long flags and their long aliases. The specific behavior is reflected in the differences between the test commit and the feat commit.

@shannmu shannmu changed the title Support hiding long flags and their long aliases feat(clap_complete): Support hiding long flags and their long aliases Jul 17, 2024
@shannmu
Copy link
Contributor Author

shannmu commented Jul 18, 2024

In the process of modifying the code, I feel that CompleteCandidate has made the code more complex. If it's just to add the visible field, should I remove the refactor commit to get this PR merged faster? (Previously, I hoped to use CompleteCandidate to replace ((OsString, Option, bool)), making the code simpler and adding other fields more centralized if we had to).

@epage
Copy link
Member

epage commented Jul 18, 2024

In the process of modifying the code, I feel that CompleteCandidate has made the code more complex. If it's just to add the visible field, should I remove the refactor commit to get this PR merged faster? (Previously, I hoped to use CompleteCandidate to replace ((OsString, Option, bool)), making the code simpler and adding other fields more centralized if we had to).

I think its worth keeping. Overuse of tuples can make the code confusing. We were already pushing the use of tuples and this would absolutely break it.

Using a struct also offers us more API stability for when we go live with this.

@epage
Copy link
Member

epage commented Jul 18, 2024

Thanks for the updates! This is looking great and look forward to the next round of improvements!

@shannmu shannmu force-pushed the hidden_flags_and_aliases branch 2 times, most recently from aa3830e to 858aaf7 Compare July 19, 2024 10:19
@shannmu shannmu marked this pull request as ready for review July 19, 2024 11:59
@epage epage merged commit 8710057 into clap-rs:master Jul 19, 2024
21 of 22 checks passed
@epage
Copy link
Member

epage commented Jul 19, 2024

Thanks!

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.

2 participants