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 -fbar and -f=bar in native completions #5576

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

shannmu
Copy link
Contributor

@shannmu shannmu commented Jul 9, 2024

related issue: #3920

This is a later PR based on #5539

What is left

Error parsing for --flag=bar in bash
more details:

pub struct CompleteArgs {
/// Specify shell to complete for
#[arg(long)]
shell: Shell,
/// Path to write completion-registration to
#[arg(long, required = true)]
register: Option<std::path::PathBuf>,
#[arg(raw = true, hide_short_help = true, group = "complete")]
comp_words: Vec<OsString>,
}

The comp_words will be ['command', '--flag', '=', 'value'] rather than ['command', '--flag=value'] because of COMP_WORDBREAKS.

@epage epage marked this pull request as draft July 10, 2024 03:22
@epage
Copy link
Member

epage commented Jul 10, 2024

Marked as draft until #5539 is merged just to be clear that this is blocked on it

@shannmu shannmu force-pushed the option_value_new branch 2 times, most recently from 8f4f97c to 9208493 Compare July 24, 2024 08:41
@shannmu shannmu marked this pull request as ready for review July 24, 2024 09:04
@epage
Copy link
Member

epage commented Jul 24, 2024

Error parsing for --flag=bar in bash

As the draft status was removed, I'm assuming this isn't a blocker for merge? Could you give some detail on why?

@shannmu
Copy link
Contributor Author

shannmu commented Jul 24, 2024

As the draft status was removed, I'm assuming this isn't a blocker for merge? Could you give some detail on why?

This error is unrelated to the Rust part of the code because it is caused by COMP WORDBREAKS. COMP WORDBREAKS affects the behavior of bash completion and is a shell-specific thing, whereas the purpose of this PR is to implement shell-agnostic completion feature.
"What is left" is intended to remind us that #3920 still has some unresolved issues, and perhaps we should address it as a separate issue.

Detail for COMP_WORDBREAKS

COMP_WORDBREAKS
The set of characters that the Readline library treats as word separators when performing word completion. If COMP_WORDBREAKS is unset, it loses its special properties, even if it is subsequently reset.

@epage epage merged commit afecaa4 into clap-rs:master Jul 25, 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