diff --git a/clap_complete/src/shells/zsh.rs b/clap_complete/src/shells/zsh.rs index 2b64739cedf..c87e4984fb1 100644 --- a/clap_complete/src/shells/zsh.rs +++ b/clap_complete/src/shells/zsh.rs @@ -633,7 +633,7 @@ fn write_positionals_of(p: &Command) -> String { debug!("write_positionals_of:iter: arg={}", arg.get_id()); let cardinality = if arg.is_multiple_values_set() || arg.is_multiple_occurrences_set() { - "*:" + "*::" } else if !arg.is_required_set() { ":" } else { diff --git a/clap_complete/tests/common.rs b/clap_complete/tests/common.rs index f68e3de1a75..faf67f9e67e 100644 --- a/clap_complete/tests/common.rs +++ b/clap_complete/tests/common.rs @@ -201,6 +201,11 @@ pub fn value_hint_command(name: &'static str) -> clap::Command<'static> { .short('c') .value_hint(clap::ValueHint::CommandString), ) + .arg( + clap::Arg::new("positional") + .required(true) + .possible_values(["stable", "nightly"]), + ) .arg( clap::Arg::new("command_with_args") .takes_value(true) diff --git a/clap_complete/tests/snapshots/basic.zsh b/clap_complete/tests/snapshots/basic.zsh index cd50968d461..59341a89bc5 100644 --- a/clap_complete/tests/snapshots/basic.zsh +++ b/clap_complete/tests/snapshots/basic.zsh @@ -39,7 +39,7 @@ _arguments "${_arguments_options[@]}" / (help) _arguments "${_arguments_options[@]}" / '-c[]' / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac diff --git a/clap_complete/tests/snapshots/feature_sample.zsh b/clap_complete/tests/snapshots/feature_sample.zsh index 96b44ef461d..b50aa56d549 100644 --- a/clap_complete/tests/snapshots/feature_sample.zsh +++ b/clap_complete/tests/snapshots/feature_sample.zsh @@ -45,7 +45,7 @@ _arguments "${_arguments_options[@]}" / ;; (help) _arguments "${_arguments_options[@]}" / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac diff --git a/clap_complete/tests/snapshots/quoting.zsh b/clap_complete/tests/snapshots/quoting.zsh index b31471ae3a1..238e587a02e 100644 --- a/clap_complete/tests/snapshots/quoting.zsh +++ b/clap_complete/tests/snapshots/quoting.zsh @@ -72,7 +72,7 @@ _arguments "${_arguments_options[@]}" / ;; (help) _arguments "${_arguments_options[@]}" / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac diff --git a/clap_complete/tests/snapshots/special_commands.zsh b/clap_complete/tests/snapshots/special_commands.zsh index c906b334284..28ba2caebd1 100644 --- a/clap_complete/tests/snapshots/special_commands.zsh +++ b/clap_complete/tests/snapshots/special_commands.zsh @@ -50,7 +50,7 @@ _arguments "${_arguments_options[@]}" / '--help[Print help information]' / '-V[Print version information]' / '--version[Print version information]' / -'*::path:' / +'*:::path:' / && ret=0 ;; (some-cmd-with-hyphens) @@ -71,7 +71,7 @@ _arguments "${_arguments_options[@]}" / ;; (help) _arguments "${_arguments_options[@]}" / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac diff --git a/clap_complete/tests/snapshots/sub_subcommands.zsh b/clap_complete/tests/snapshots/sub_subcommands.zsh index 947d0cb4ec8..f6f864d792b 100644 --- a/clap_complete/tests/snapshots/sub_subcommands.zsh +++ b/clap_complete/tests/snapshots/sub_subcommands.zsh @@ -70,7 +70,7 @@ _arguments "${_arguments_options[@]}" / ;; (help) _arguments "${_arguments_options[@]}" / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac @@ -79,7 +79,7 @@ esac ;; (help) _arguments "${_arguments_options[@]}" / -'*::subcommand -- The subcommand whose help message to display:' / +'*:::subcommand -- The subcommand whose help message to display:' / && ret=0 ;; esac diff --git a/clap_complete/tests/snapshots/value_hint.bash b/clap_complete/tests/snapshots/value_hint.bash index 39e8208b864..469b1cc640d 100644 --- a/clap_complete/tests/snapshots/value_hint.bash +++ b/clap_complete/tests/snapshots/value_hint.bash @@ -19,7 +19,7 @@ _my-app() { case "${cmd}" in my__app) - opts="-p -f -d -e -c -u -h --help --choice --unknown --other --path --file --dir --exe --cmd-name --cmd --user --host --url --email ..." + opts="-p -f -d -e -c -u -h --help --choice --unknown --other --path --file --dir --exe --cmd-name --cmd --user --host --url --email stable nightly ..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 diff --git a/clap_complete/tests/snapshots/value_hint.zsh b/clap_complete/tests/snapshots/value_hint.zsh index 1bb1411e86f..339486f49bb 100644 --- a/clap_complete/tests/snapshots/value_hint.zsh +++ b/clap_complete/tests/snapshots/value_hint.zsh @@ -36,7 +36,8 @@ _my-app() { '--url=[]: :_urls' / '--email=[]: :_email_addresses' / '--help[Print help information]' / -'*::command_with_args:_cmdambivalent' / +':positional:(stable nightly)' / +'*:::command_with_args:_cmdambivalent' / && ret=0 }