Replies: 2 comments
-
We don't support this yet; it is being tracked in #5587. It would help if you posted your use case. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you for your reply! My current use case is similar to zsh’s built-in directory completion: if completion items end with “/”, then need to add For example: fn custom_completer(current: &std::ffi::OsStr) -> Vec<CompletionCandidate> {
if current.to_string_lossy().starts_with("dir0/") {
// Should not add `nospace` flag
return vec![
CompletionCandidate::new("dir0/file0"),
CompletionCandidate::new("dir0/file1"),
];
}
// Should add `nospace` flag
vec![
CompletionCandidate::new("dir0/"),
CompletionCandidate::new("dir1/"),
]
} Maybe add a return flag to contol this? struct CompletionCandidates {
items: Vec<CompletionCandidate>,
no_space: bool,
}
fn custom_completer(current: &std::ffi::OsStr) -> CompletionCandidates {
if current.to_string_lossy().starts_with("dir0/") {
// Should not add `nospace` flag
return CompletionCandidates {
items: vec![
CompletionCandidate::new("dir0/file0"),
CompletionCandidate::new("dir0/file1"),
],
no_space: false,
};
}
// Should add `nospace` flag
CompletionCandidates {
items: vec![
CompletionCandidate::new("dir0/"),
CompletionCandidate::new("dir1/"),
],
no_space: true,
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am trying the clap_complete
unstable-dynamic
feature.When I complete somethings, how to set
-S ''
flag? I need to use this in some scenes.Beta Was this translation helpful? Give feedback.
All reactions