mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
Merge pull request #3469 from gibfahn/fish_completion
fix(complete): escape fish possible values
This commit is contained in:
commit
182e5739c3
2 changed files with 6 additions and 3 deletions
|
@ -158,8 +158,8 @@ fn value_completion(option: &Arg) -> String {
|
|||
} else {
|
||||
Some(format!(
|
||||
"{}\t{}",
|
||||
value.get_name(),
|
||||
value.get_help().unwrap_or_default()
|
||||
escape_string(value.get_name()).as_str(),
|
||||
escape_string(value.get_help().unwrap_or_default()).as_str()
|
||||
))
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use clap::PossibleValue;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn build_app() -> App<'static> {
|
||||
|
@ -172,6 +174,7 @@ fn build_app_sub_subcommands() -> App<'static> {
|
|||
Arg::new("config")
|
||||
.long("--config")
|
||||
.takes_value(true)
|
||||
.possible_values([PossibleValue::new("Lest quotes aren't escaped.")])
|
||||
.help("the other case to test"),
|
||||
),
|
||||
),
|
||||
|
@ -190,7 +193,7 @@ complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen
|
|||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version information'
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r -f -a "{Lest quotes aren\'t escaped. }"
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s h -l help -d 'Print help information'
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from sub_cmd" -s V -l version -d 'Print version information'
|
||||
complete -c my_app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
|
||||
|
|
Loading…
Reference in a new issue