complete/zsh: improve --hyperlink-format completion
Also don't re-define helper functions if they exist. Closes #3102
This commit is contained in:
@@ -19,5 +19,14 @@ long as it meets criteria 3 and 4 above.
|
||||
|
||||
/// Generate completions for zsh.
|
||||
pub(crate) fn generate() -> String {
|
||||
include_str!("rg.zsh").replace("!ENCODINGS!", super::ENCODINGS.trim_end())
|
||||
let hyperlink_alias_descriptions = grep::printer::hyperlink_aliases()
|
||||
.iter()
|
||||
.map(|alias| {
|
||||
format!(r#" {}:"{}""#, alias.name(), alias.description())
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n");
|
||||
include_str!("rg.zsh")
|
||||
.replace("!ENCODINGS!", super::ENCODINGS.trim_end())
|
||||
.replace("!HYPERLINK_ALIASES!", &hyperlink_alias_descriptions)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user