-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
chore(complete): Add descriptions to dynamic Zsh completions #5775
base: master
Are you sure you want to change the base?
Conversation
a95db64
to
334a742
Compare
Also, I had to add this to my zshrc to prevent zsh from changing the order of suggestions: zstyle ':completion:*:*:my-program:*:*' sort false Not necessarily a problem, but it could be worth documenting, or maybe write it in the completion script? |
clap_complete/src/env/shells.rs
Outdated
/// Escape help string | ||
fn escape_help(string: &str) -> String { | ||
string.replace('\\', "\\\\") | ||
} | ||
|
||
/// Escape value string | ||
fn escape_value(string: &str) -> String { | ||
string.replace('\\', "\\\\").replace(':', "\\:") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you swap these? Values are generally listed in our code and in the zsh output before help, so by switching the order, people will have a smoother time reading this
(I was confused at first and had to double check what I was reading)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I've swapped escape_help
and escape_value
methods.
We generally want things sorted according to our order. We tweaked bash to ensure this. If you know how to do insert this in our script to be respected, please help us out and post a PR for this! |
I'll give it a try! (Not in this PR.) |
When using
unstable-dynamic
completions in Zsh, suggested values are not described. It's a step backwards compared to the default behavior and it makes things more difficult for users.I had a quick look and it seems relatively easy to fix. But I'm not familiar with either clap or Zsh autocompletion, so I may miss something here.