Skip to content

Commit 5cc44bb

Browse files
authored
Merge pull request #5548 from tesuji/fish-escape-tab
style: fish: escaping tab as \t for more readibility
2 parents 181b9e0 + b16f987 commit 5cc44bb

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

clap_complete/src/shells/fish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn value_completion(option: &Arg) -> String {
178178
// The help text after \t is wrapped in '' to make sure that the it is taken literally
179179
// and there is no command substitution or variable expansion resulting in unexpected errors
180180
Some(format!(
181-
"{}\t'{}'",
181+
"{}\\t'{}'",
182182
escape_string(value.get_name(), true).as_str(),
183183
escape_help(value.get_help().unwrap_or_default())
184184
))

clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/completions/exhaustive.fish

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
complete -c exhaustive -n "__fish_use_subcommand" -l generate -d 'generate' -r -f -a "{bash '',elvish '',fish '',powershell '',zsh ''}"
1+
complete -c exhaustive -n "__fish_use_subcommand" -l generate -d 'generate' -r -f -a "{bash\t'',elvish\t'',fish\t'',powershell\t'',zsh\t''}"
22
complete -c exhaustive -n "__fish_use_subcommand" -l global -d 'everywhere'
33
complete -c exhaustive -n "__fish_use_subcommand" -s h -l help -d 'Print help'
44
complete -c exhaustive -n "__fish_use_subcommand" -s V -l version -d 'Print version'
@@ -12,13 +12,13 @@ complete -c exhaustive -n "__fish_use_subcommand" -f -a "hint"
1212
complete -c exhaustive -n "__fish_use_subcommand" -f -a "complete" -d 'Register shell completions for this program'
1313
complete -c exhaustive -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
1414
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l set -d 'value' -r
15-
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l choice -d 'enum' -r -f -a "{first '',second ''}"
15+
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l choice -d 'enum' -r -f -a "{first\t'',second\t''}"
1616
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l set-true -d 'bool'
1717
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l count -d 'number'
1818
complete -c exhaustive -n "__fish_seen_subcommand_from action" -l global -d 'everywhere'
1919
complete -c exhaustive -n "__fish_seen_subcommand_from action" -s h -l help -d 'Print help'
2020
complete -c exhaustive -n "__fish_seen_subcommand_from action" -s V -l version -d 'Print version'
21-
complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from escape-help; and not __fish_seen_subcommand_from help" -l choice -r -f -a "{bash 'bash (shell)',fish 'fish shell',zsh 'zsh shell'}"
21+
complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from escape-help; and not __fish_seen_subcommand_from help" -l choice -r -f -a "{bash\t'bash (shell)',fish\t'fish shell',zsh\t'zsh shell'}"
2222
complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from escape-help; and not __fish_seen_subcommand_from help" -l single-quotes -d 'Can be \'always\', \'auto\', or \'never\''
2323
complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from escape-help; and not __fish_seen_subcommand_from help" -l double-quotes -d 'Can be "always", "auto", or "never"'
2424
complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from escape-help; and not __fish_seen_subcommand_from help" -l backticks -d 'For more information see `echo test`'
@@ -94,7 +94,7 @@ complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s f -s F -l flag
9494
complete -c exhaustive -n "__fish_seen_subcommand_from alias" -l global -d 'everywhere'
9595
complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s h -l help -d 'Print help'
9696
complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s V -l version -d 'Print version'
97-
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l choice -r -f -a "{bash '',fish '',zsh ''}"
97+
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l choice -r -f -a "{bash\t'',fish\t'',zsh\t''}"
9898
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l unknown -r
9999
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l other -r -f
100100
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s p -l path -r -F
@@ -110,7 +110,7 @@ complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l email -r -f
110110
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l global -d 'everywhere'
111111
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s h -l help -d 'Print help'
112112
complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s V -l version -d 'Print version'
113-
complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l shell -d 'Specify shell to complete for' -r -f -a "{bash '',fish ''}"
113+
complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l shell -d 'Specify shell to complete for' -r -f -a "{bash\t'',fish\t''}"
114114
complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l register -d 'Path to write completion-registration to' -r -F
115115
complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l global -d 'everywhere'
116116
complete -c exhaustive -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help (see more with \'--help\')'

clap_complete/tests/snapshots/sub_subcommands.fish

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and not __fish_seen
1212
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'
1313
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'
1414
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)'
15-
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. 'help,with,comma',Second to trigger display of options ''}"
15+
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.\t'help,with,comma',Second to trigger display of options\t''}"
1616
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 (see more with \'--help\')'
1717
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'
1818
complete -c my-app -n "__fish_seen_subcommand_from some_cmd; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'
@@ -21,7 +21,7 @@ complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and not __fis
2121
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version'
2222
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'
2323
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; 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)'
24-
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r -f -a "{Lest quotes\, aren\'t escaped. 'help,with,comma',Second to trigger display of options ''}"
24+
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and __fish_seen_subcommand_from sub_cmd" -l config -d 'the other case to test' -r -f -a "{Lest quotes\, aren\'t escaped.\t'help,with,comma',Second to trigger display of options\t''}"
2525
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and __fish_seen_subcommand_from sub_cmd" -s h -l help -d 'Print help (see more with \'--help\')'
2626
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and __fish_seen_subcommand_from sub_cmd" -s V -l version -d 'Print version'
2727
complete -c my-app -n "__fish_seen_subcommand_from some_cmd_alias; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from sub_cmd; and not __fish_seen_subcommand_from help" -f -a "sub_cmd" -d 'sub-subcommand'

clap_complete/tests/snapshots/value_hint.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
complete -c my-app -l choice -r -f -a "{bash '',fish '',zsh ''}"
1+
complete -c my-app -l choice -r -f -a "{bash\t'',fish\t'',zsh\t''}"
22
complete -c my-app -l unknown -r
33
complete -c my-app -l other -r -f
44
complete -c my-app -s p -l path -r -F

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy