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 flags with values --flag barand -f bar in native completions #5539

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

shannmu
Copy link
Contributor

@shannmu shannmu commented Jun 19, 2024

related issue: #3920
what is left

  • support -fbar and -f=bar
  • error parsing for --flag=bar in bash
  • foo --bar\t offering both --bar <value> and --bare

@shannmu shannmu force-pushed the option_value branch 3 times, most recently from 05ab44a to 456053d Compare June 29, 2024 17:15
@shannmu shannmu force-pushed the option_value branch 2 times, most recently from 4c6e44b to 46dcc90 Compare June 29, 2024 19:17
@shannmu shannmu changed the title feat(clap_complete): Add support --flag bar and -f bar completion feat(clap_complete): Support flags with values in native completions Jun 30, 2024
@shannmu
Copy link
Contributor Author

shannmu commented Jun 30, 2024

The cases of -fbar and -f=bar have not been handled yet.

@shannmu
Copy link
Contributor Author

shannmu commented Jun 30, 2024

I have added support for -fbar and -f=bar completion.

completions.extend(
shorts_and_visible_aliases(cmd)
.into_iter()
// HACK: Need better `OsStr` manipulation
.map(|(f, help)| (format!("{}{}", dash_or_arg, f).into(), help)),
);

This code didn't consider the case -f=bar[TAB], so it could generate -f=barf in completions. I will fix it later.

@epage
Copy link
Member

epage commented Jul 8, 2024

While talked about this in the call, to not lose track of this

I have added support for -fbar and -f=bar completion.

Please split that out into another branch for a later PR so we can focus on getting the current PR merged.

@shannmu shannmu changed the title feat(clap_complete): Support flags with values in native completions feat(clap_complete): Support flags with values --flag barand -f bar in native completions Jul 9, 2024
@epage epage merged commit a271c19 into clap-rs:master Jul 23, 2024
21 of 22 checks passed
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.

None yet

2 participants