diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /vendor/clap_complete/src/shells/elvish.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/clap_complete/src/shells/elvish.rs')
-rw-r--r-- | vendor/clap_complete/src/shells/elvish.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/vendor/clap_complete/src/shells/elvish.rs b/vendor/clap_complete/src/shells/elvish.rs index 959372087..07da28348 100644 --- a/vendor/clap_complete/src/shells/elvish.rs +++ b/vendor/clap_complete/src/shells/elvish.rs @@ -1,5 +1,6 @@ use std::io::Write; +use clap::builder::StyledStr; use clap::*; use crate::generator::{utils, Generator}; @@ -19,8 +20,7 @@ impl Generator for Elvish { .get_bin_name() .expect("crate::generate should have set the bin_name"); - let mut names = vec![]; - let subcommands_cases = generate_inner(cmd, "", &mut names); + let subcommands_cases = generate_inner(cmd, ""); let result = format!( r#" @@ -59,18 +59,14 @@ fn escape_string(string: &str) -> String { string.replace('\'', "''") } -fn get_tooltip<T: ToString>(help: Option<&str>, data: T) -> String { +fn get_tooltip<T: ToString>(help: Option<&StyledStr>, data: T) -> String { match help { - Some(help) => escape_string(help), + Some(help) => escape_string(&help.to_string()), _ => data.to_string(), } } -fn generate_inner<'help>( - p: &Command<'help>, - previous_command_name: &str, - names: &mut Vec<&'help str>, -) -> String { +fn generate_inner(p: &Command, previous_command_name: &str) -> String { debug!("generate_inner"); let command_name = if previous_command_name.is_empty() { @@ -134,7 +130,7 @@ fn generate_inner<'help>( ); for subcommand in p.get_subcommands() { - let subcommand_subcommands_cases = generate_inner(subcommand, &command_name, names); + let subcommand_subcommands_cases = generate_inner(subcommand, &command_name); subcommands_cases.push_str(&subcommand_subcommands_cases); } |