diff --git a/clap_complete/src/shells/zsh.rs b/clap_complete/src/shells/zsh.rs index 65c26d78..f6ca8dd8 100644 --- a/clap_complete/src/shells/zsh.rs +++ b/clap_complete/src/shells/zsh.rs @@ -110,12 +110,15 @@ _{bin_name_underscore}_commands() {{ ret.push(parent_text); // Next we start looping through all the children, grandchildren, etc. - let mut all_subcommands = utils::all_subcommands(p); + let mut all_subcommand_bins: Vec<_> = utils::all_subcommands(p) + .into_iter() + .map(|(_sc_name, bin_name)| bin_name) + .collect(); - all_subcommands.sort(); - all_subcommands.dedup(); + all_subcommand_bins.sort(); + all_subcommand_bins.dedup(); - for (_, ref bin_name) in &all_subcommands { + for bin_name in &all_subcommand_bins { debug!("subcommand_details:iter: bin_name={bin_name}"); ret.push(format!( diff --git a/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive b/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive index 7308976a..91a856c7 100644 --- a/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive +++ b/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive @@ -472,136 +472,16 @@ _exhaustive__action_commands() { local commands; commands=() _describe -t commands 'exhaustive action commands' commands "$@" } -(( $+functions[_exhaustive__help__action_commands] )) || -_exhaustive__help__action_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help action commands' commands "$@" -} (( $+functions[_exhaustive__alias_commands] )) || _exhaustive__alias_commands() { local commands; commands=() _describe -t commands 'exhaustive alias commands' commands "$@" } -(( $+functions[_exhaustive__help__alias_commands] )) || -_exhaustive__help__alias_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help alias commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-backslash_commands] )) || -_exhaustive__help__quote__cmd-backslash_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-backslash commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-backslash_commands] )) || -_exhaustive__quote__cmd-backslash_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-backslash commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-backslash_commands] )) || -_exhaustive__quote__help__cmd-backslash_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-backslash commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-backticks_commands] )) || -_exhaustive__help__quote__cmd-backticks_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-backticks commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-backticks_commands] )) || -_exhaustive__quote__cmd-backticks_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-backticks commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-backticks_commands] )) || -_exhaustive__quote__help__cmd-backticks_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-backticks commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-brackets_commands] )) || -_exhaustive__help__quote__cmd-brackets_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-brackets commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-brackets_commands] )) || -_exhaustive__quote__cmd-brackets_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-brackets commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-brackets_commands] )) || -_exhaustive__quote__help__cmd-brackets_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-brackets commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-double-quotes_commands] )) || -_exhaustive__help__quote__cmd-double-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-double-quotes commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-double-quotes_commands] )) || -_exhaustive__quote__cmd-double-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-double-quotes commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-double-quotes_commands] )) || -_exhaustive__quote__help__cmd-double-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-double-quotes commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-expansions_commands] )) || -_exhaustive__help__quote__cmd-expansions_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-expansions commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-expansions_commands] )) || -_exhaustive__quote__cmd-expansions_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-expansions commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-expansions_commands] )) || -_exhaustive__quote__help__cmd-expansions_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-expansions commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__cmd-single-quotes_commands] )) || -_exhaustive__help__quote__cmd-single-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote cmd-single-quotes commands' commands "$@" -} -(( $+functions[_exhaustive__quote__cmd-single-quotes_commands] )) || -_exhaustive__quote__cmd-single-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote cmd-single-quotes commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__cmd-single-quotes_commands] )) || -_exhaustive__quote__help__cmd-single-quotes_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help cmd-single-quotes commands' commands "$@" -} (( $+functions[_exhaustive__complete_commands] )) || _exhaustive__complete_commands() { local commands; commands=() _describe -t commands 'exhaustive complete commands' commands "$@" } -(( $+functions[_exhaustive__help__complete_commands] )) || -_exhaustive__help__complete_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help complete commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote__escape-help_commands] )) || -_exhaustive__help__quote__escape-help_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help quote escape-help commands' commands "$@" -} -(( $+functions[_exhaustive__quote__escape-help_commands] )) || -_exhaustive__quote__escape-help_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote escape-help commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__escape-help_commands] )) || -_exhaustive__quote__help__escape-help_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help escape-help commands' commands "$@" -} (( $+functions[_exhaustive__help_commands] )) || _exhaustive__help_commands() { local commands; commands=( @@ -617,11 +497,126 @@ _exhaustive__help_commands() { ) _describe -t commands 'exhaustive help commands' commands "$@" } +(( $+functions[_exhaustive__help__action_commands] )) || +_exhaustive__help__action_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help action commands' commands "$@" +} +(( $+functions[_exhaustive__help__alias_commands] )) || +_exhaustive__help__alias_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help alias commands' commands "$@" +} +(( $+functions[_exhaustive__help__complete_commands] )) || +_exhaustive__help__complete_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help complete commands' commands "$@" +} (( $+functions[_exhaustive__help__help_commands] )) || _exhaustive__help__help_commands() { local commands; commands=() _describe -t commands 'exhaustive help help commands' commands "$@" } +(( $+functions[_exhaustive__help__hint_commands] )) || +_exhaustive__help__hint_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help hint commands' commands "$@" +} +(( $+functions[_exhaustive__help__last_commands] )) || +_exhaustive__help__last_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help last commands' commands "$@" +} +(( $+functions[_exhaustive__help__pacman_commands] )) || +_exhaustive__help__pacman_commands() { + local commands; commands=( +'one:' \ +'two:' \ + ) + _describe -t commands 'exhaustive help pacman commands' commands "$@" +} +(( $+functions[_exhaustive__help__pacman__one_commands] )) || +_exhaustive__help__pacman__one_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help pacman one commands' commands "$@" +} +(( $+functions[_exhaustive__help__pacman__two_commands] )) || +_exhaustive__help__pacman__two_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help pacman two commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote_commands] )) || +_exhaustive__help__quote_commands() { + local commands; commands=( +'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ +'cmd-double-quotes:Can be "always", "auto", or "never"' \ +'cmd-backticks:For more information see \`echo test\`' \ +'cmd-backslash:Avoid '\''\\n'\''' \ +'cmd-brackets:List packages \[filter\]' \ +'cmd-expansions:Execute the shell command with \$SHELL' \ +'escape-help:\\tab "'\'' New Line' \ + ) + _describe -t commands 'exhaustive help quote commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-backslash_commands] )) || +_exhaustive__help__quote__cmd-backslash_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-backslash commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-backticks_commands] )) || +_exhaustive__help__quote__cmd-backticks_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-backticks commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-brackets_commands] )) || +_exhaustive__help__quote__cmd-brackets_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-brackets commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-double-quotes_commands] )) || +_exhaustive__help__quote__cmd-double-quotes_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-double-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-expansions_commands] )) || +_exhaustive__help__quote__cmd-expansions_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-expansions commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__cmd-single-quotes_commands] )) || +_exhaustive__help__quote__cmd-single-quotes_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote cmd-single-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__help__quote__escape-help_commands] )) || +_exhaustive__help__quote__escape-help_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help quote escape-help commands' commands "$@" +} +(( $+functions[_exhaustive__help__value_commands] )) || +_exhaustive__help__value_commands() { + local commands; commands=() + _describe -t commands 'exhaustive help value commands' commands "$@" +} +(( $+functions[_exhaustive__hint_commands] )) || +_exhaustive__hint_commands() { + local commands; commands=() + _describe -t commands 'exhaustive hint commands' commands "$@" +} +(( $+functions[_exhaustive__last_commands] )) || +_exhaustive__last_commands() { + local commands; commands=() + _describe -t commands 'exhaustive last commands' commands "$@" +} +(( $+functions[_exhaustive__pacman_commands] )) || +_exhaustive__pacman_commands() { + local commands; commands=( +'one:' \ +'two:' \ +'help:Print this message or the help of the given subcommand(s)' \ + ) + _describe -t commands 'exhaustive pacman commands' commands "$@" +} (( $+functions[_exhaustive__pacman__help_commands] )) || _exhaustive__pacman__help_commands() { local commands; commands=( @@ -636,89 +631,25 @@ _exhaustive__pacman__help__help_commands() { local commands; commands=() _describe -t commands 'exhaustive pacman help help commands' commands "$@" } -(( $+functions[_exhaustive__quote__help_commands] )) || -_exhaustive__quote__help_commands() { - local commands; commands=( -'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ -'cmd-double-quotes:Can be "always", "auto", or "never"' \ -'cmd-backticks:For more information see \`echo test\`' \ -'cmd-backslash:Avoid '\''\\n'\''' \ -'cmd-brackets:List packages \[filter\]' \ -'cmd-expansions:Execute the shell command with \$SHELL' \ -'escape-help:\\tab "'\'' New Line' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'exhaustive quote help commands' commands "$@" -} -(( $+functions[_exhaustive__quote__help__help_commands] )) || -_exhaustive__quote__help__help_commands() { - local commands; commands=() - _describe -t commands 'exhaustive quote help help commands' commands "$@" -} -(( $+functions[_exhaustive__help__hint_commands] )) || -_exhaustive__help__hint_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help hint commands' commands "$@" -} -(( $+functions[_exhaustive__hint_commands] )) || -_exhaustive__hint_commands() { - local commands; commands=() - _describe -t commands 'exhaustive hint commands' commands "$@" -} -(( $+functions[_exhaustive__help__last_commands] )) || -_exhaustive__help__last_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help last commands' commands "$@" -} -(( $+functions[_exhaustive__last_commands] )) || -_exhaustive__last_commands() { - local commands; commands=() - _describe -t commands 'exhaustive last commands' commands "$@" -} -(( $+functions[_exhaustive__help__pacman__one_commands] )) || -_exhaustive__help__pacman__one_commands() { - local commands; commands=() - _describe -t commands 'exhaustive help pacman one commands' commands "$@" -} (( $+functions[_exhaustive__pacman__help__one_commands] )) || _exhaustive__pacman__help__one_commands() { local commands; commands=() _describe -t commands 'exhaustive pacman help one commands' commands "$@" } +(( $+functions[_exhaustive__pacman__help__two_commands] )) || +_exhaustive__pacman__help__two_commands() { + local commands; commands=() + _describe -t commands 'exhaustive pacman help two commands' commands "$@" +} (( $+functions[_exhaustive__pacman__one_commands] )) || _exhaustive__pacman__one_commands() { local commands; commands=() _describe -t commands 'exhaustive pacman one commands' commands "$@" } -(( $+functions[_exhaustive__help__pacman_commands] )) || -_exhaustive__help__pacman_commands() { - local commands; commands=( -'one:' \ -'two:' \ - ) - _describe -t commands 'exhaustive help pacman commands' commands "$@" -} -(( $+functions[_exhaustive__pacman_commands] )) || -_exhaustive__pacman_commands() { - local commands; commands=( -'one:' \ -'two:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'exhaustive pacman commands' commands "$@" -} -(( $+functions[_exhaustive__help__quote_commands] )) || -_exhaustive__help__quote_commands() { - local commands; commands=( -'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ -'cmd-double-quotes:Can be "always", "auto", or "never"' \ -'cmd-backticks:For more information see \`echo test\`' \ -'cmd-backslash:Avoid '\''\\n'\''' \ -'cmd-brackets:List packages \[filter\]' \ -'cmd-expansions:Execute the shell command with \$SHELL' \ -'escape-help:\\tab "'\'' New Line' \ - ) - _describe -t commands 'exhaustive help quote commands' commands "$@" +(( $+functions[_exhaustive__pacman__two_commands] )) || +_exhaustive__pacman__two_commands() { + local commands; commands=() + _describe -t commands 'exhaustive pacman two commands' commands "$@" } (( $+functions[_exhaustive__quote_commands] )) || _exhaustive__quote_commands() { @@ -734,25 +665,94 @@ _exhaustive__quote_commands() { ) _describe -t commands 'exhaustive quote commands' commands "$@" } -(( $+functions[_exhaustive__help__pacman__two_commands] )) || -_exhaustive__help__pacman__two_commands() { +(( $+functions[_exhaustive__quote__cmd-backslash_commands] )) || +_exhaustive__quote__cmd-backslash_commands() { local commands; commands=() - _describe -t commands 'exhaustive help pacman two commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-backslash commands' commands "$@" } -(( $+functions[_exhaustive__pacman__help__two_commands] )) || -_exhaustive__pacman__help__two_commands() { +(( $+functions[_exhaustive__quote__cmd-backticks_commands] )) || +_exhaustive__quote__cmd-backticks_commands() { local commands; commands=() - _describe -t commands 'exhaustive pacman help two commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-backticks commands' commands "$@" } -(( $+functions[_exhaustive__pacman__two_commands] )) || -_exhaustive__pacman__two_commands() { +(( $+functions[_exhaustive__quote__cmd-brackets_commands] )) || +_exhaustive__quote__cmd-brackets_commands() { local commands; commands=() - _describe -t commands 'exhaustive pacman two commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-brackets commands' commands "$@" } -(( $+functions[_exhaustive__help__value_commands] )) || -_exhaustive__help__value_commands() { +(( $+functions[_exhaustive__quote__cmd-double-quotes_commands] )) || +_exhaustive__quote__cmd-double-quotes_commands() { local commands; commands=() - _describe -t commands 'exhaustive help value commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-double-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__quote__cmd-expansions_commands] )) || +_exhaustive__quote__cmd-expansions_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote cmd-expansions commands' commands "$@" +} +(( $+functions[_exhaustive__quote__cmd-single-quotes_commands] )) || +_exhaustive__quote__cmd-single-quotes_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote cmd-single-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__quote__escape-help_commands] )) || +_exhaustive__quote__escape-help_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote escape-help commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help_commands] )) || +_exhaustive__quote__help_commands() { + local commands; commands=( +'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ +'cmd-double-quotes:Can be "always", "auto", or "never"' \ +'cmd-backticks:For more information see \`echo test\`' \ +'cmd-backslash:Avoid '\''\\n'\''' \ +'cmd-brackets:List packages \[filter\]' \ +'cmd-expansions:Execute the shell command with \$SHELL' \ +'escape-help:\\tab "'\'' New Line' \ +'help:Print this message or the help of the given subcommand(s)' \ + ) + _describe -t commands 'exhaustive quote help commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-backslash_commands] )) || +_exhaustive__quote__help__cmd-backslash_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-backslash commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-backticks_commands] )) || +_exhaustive__quote__help__cmd-backticks_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-backticks commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-brackets_commands] )) || +_exhaustive__quote__help__cmd-brackets_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-brackets commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-double-quotes_commands] )) || +_exhaustive__quote__help__cmd-double-quotes_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-double-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-expansions_commands] )) || +_exhaustive__quote__help__cmd-expansions_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-expansions commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__cmd-single-quotes_commands] )) || +_exhaustive__quote__help__cmd-single-quotes_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help cmd-single-quotes commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__escape-help_commands] )) || +_exhaustive__quote__help__escape-help_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help escape-help commands' commands "$@" +} +(( $+functions[_exhaustive__quote__help__help_commands] )) || +_exhaustive__quote__help__help_commands() { + local commands; commands=() + _describe -t commands 'exhaustive quote help help commands' commands "$@" } (( $+functions[_exhaustive__value_commands] )) || _exhaustive__value_commands() { diff --git a/clap_complete/tests/snapshots/quoting.zsh b/clap_complete/tests/snapshots/quoting.zsh index 7e36d721..3017c4e1 100644 --- a/clap_complete/tests/snapshots/quoting.zsh +++ b/clap_complete/tests/snapshots/quoting.zsh @@ -137,61 +137,31 @@ _my-app__cmd-backslash_commands() { local commands; commands=() _describe -t commands 'my-app cmd-backslash commands' commands "$@" } -(( $+functions[_my-app__help__cmd-backslash_commands] )) || -_my-app__help__cmd-backslash_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-backslash commands' commands "$@" -} (( $+functions[_my-app__cmd-backticks_commands] )) || _my-app__cmd-backticks_commands() { local commands; commands=() _describe -t commands 'my-app cmd-backticks commands' commands "$@" } -(( $+functions[_my-app__help__cmd-backticks_commands] )) || -_my-app__help__cmd-backticks_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-backticks commands' commands "$@" -} (( $+functions[_my-app__cmd-brackets_commands] )) || _my-app__cmd-brackets_commands() { local commands; commands=() _describe -t commands 'my-app cmd-brackets commands' commands "$@" } -(( $+functions[_my-app__help__cmd-brackets_commands] )) || -_my-app__help__cmd-brackets_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-brackets commands' commands "$@" -} (( $+functions[_my-app__cmd-double-quotes_commands] )) || _my-app__cmd-double-quotes_commands() { local commands; commands=() _describe -t commands 'my-app cmd-double-quotes commands' commands "$@" } -(( $+functions[_my-app__help__cmd-double-quotes_commands] )) || -_my-app__help__cmd-double-quotes_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-double-quotes commands' commands "$@" -} (( $+functions[_my-app__cmd-expansions_commands] )) || _my-app__cmd-expansions_commands() { local commands; commands=() _describe -t commands 'my-app cmd-expansions commands' commands "$@" } -(( $+functions[_my-app__help__cmd-expansions_commands] )) || -_my-app__help__cmd-expansions_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-expansions commands' commands "$@" -} (( $+functions[_my-app__cmd-single-quotes_commands] )) || _my-app__cmd-single-quotes_commands() { local commands; commands=() _describe -t commands 'my-app cmd-single-quotes commands' commands "$@" } -(( $+functions[_my-app__help__cmd-single-quotes_commands] )) || -_my-app__help__cmd-single-quotes_commands() { - local commands; commands=() - _describe -t commands 'my-app help cmd-single-quotes commands' commands "$@" -} (( $+functions[_my-app__help_commands] )) || _my-app__help_commands() { local commands; commands=( @@ -205,6 +175,36 @@ _my-app__help_commands() { ) _describe -t commands 'my-app help commands' commands "$@" } +(( $+functions[_my-app__help__cmd-backslash_commands] )) || +_my-app__help__cmd-backslash_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-backslash commands' commands "$@" +} +(( $+functions[_my-app__help__cmd-backticks_commands] )) || +_my-app__help__cmd-backticks_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-backticks commands' commands "$@" +} +(( $+functions[_my-app__help__cmd-brackets_commands] )) || +_my-app__help__cmd-brackets_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-brackets commands' commands "$@" +} +(( $+functions[_my-app__help__cmd-double-quotes_commands] )) || +_my-app__help__cmd-double-quotes_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-double-quotes commands' commands "$@" +} +(( $+functions[_my-app__help__cmd-expansions_commands] )) || +_my-app__help__cmd-expansions_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-expansions commands' commands "$@" +} +(( $+functions[_my-app__help__cmd-single-quotes_commands] )) || +_my-app__help__cmd-single-quotes_commands() { + local commands; commands=() + _describe -t commands 'my-app help cmd-single-quotes commands' commands "$@" +} (( $+functions[_my-app__help__help_commands] )) || _my-app__help__help_commands() { local commands; commands=() diff --git a/clap_complete/tests/snapshots/special_commands.zsh b/clap_complete/tests/snapshots/special_commands.zsh index 67d04bda..4429003a 100644 --- a/clap_complete/tests/snapshots/special_commands.zsh +++ b/clap_complete/tests/snapshots/special_commands.zsh @@ -142,36 +142,36 @@ _my-app__help__some-cmd-with-hyphens_commands() { local commands; commands=() _describe -t commands 'my-app help some-cmd-with-hyphens commands' commands "$@" } -(( $+functions[_my-app__some-cmd-with-hyphens_commands] )) || -_my-app__some-cmd-with-hyphens_commands() { - local commands; commands=() - _describe -t commands 'my-app some-cmd-with-hyphens commands' commands "$@" -} (( $+functions[_my-app__help__some-hidden-cmd_commands] )) || _my-app__help__some-hidden-cmd_commands() { local commands; commands=() _describe -t commands 'my-app help some-hidden-cmd commands' commands "$@" } -(( $+functions[_my-app__some-hidden-cmd_commands] )) || -_my-app__some-hidden-cmd_commands() { - local commands; commands=() - _describe -t commands 'my-app some-hidden-cmd commands' commands "$@" -} (( $+functions[_my-app__help__some_cmd_commands] )) || _my-app__help__some_cmd_commands() { local commands; commands=() _describe -t commands 'my-app help some_cmd commands' commands "$@" } -(( $+functions[_my-app__some_cmd_commands] )) || -_my-app__some_cmd_commands() { - local commands; commands=() - _describe -t commands 'my-app some_cmd commands' commands "$@" -} (( $+functions[_my-app__help__test_commands] )) || _my-app__help__test_commands() { local commands; commands=() _describe -t commands 'my-app help test commands' commands "$@" } +(( $+functions[_my-app__some-cmd-with-hyphens_commands] )) || +_my-app__some-cmd-with-hyphens_commands() { + local commands; commands=() + _describe -t commands 'my-app some-cmd-with-hyphens commands' commands "$@" +} +(( $+functions[_my-app__some-hidden-cmd_commands] )) || +_my-app__some-hidden-cmd_commands() { + local commands; commands=() + _describe -t commands 'my-app some-hidden-cmd commands' commands "$@" +} +(( $+functions[_my-app__some_cmd_commands] )) || +_my-app__some_cmd_commands() { + local commands; commands=() + _describe -t commands 'my-app some_cmd commands' commands "$@" +} (( $+functions[_my-app__test_commands] )) || _my-app__test_commands() { local commands; commands=() diff --git a/clap_complete/tests/snapshots/sub_subcommands.zsh b/clap_complete/tests/snapshots/sub_subcommands.zsh index 720e72f1..09f4bd7c 100644 --- a/clap_complete/tests/snapshots/sub_subcommands.zsh +++ b/clap_complete/tests/snapshots/sub_subcommands.zsh @@ -170,6 +170,31 @@ _my-app__help__help_commands() { local commands; commands=() _describe -t commands 'my-app help help commands' commands "$@" } +(( $+functions[_my-app__help__some_cmd_commands] )) || +_my-app__help__some_cmd_commands() { + local commands; commands=( +'sub_cmd:sub-subcommand' \ + ) + _describe -t commands 'my-app help some_cmd commands' commands "$@" +} +(( $+functions[_my-app__help__some_cmd__sub_cmd_commands] )) || +_my-app__help__some_cmd__sub_cmd_commands() { + local commands; commands=() + _describe -t commands 'my-app help some_cmd sub_cmd commands' commands "$@" +} +(( $+functions[_my-app__help__test_commands] )) || +_my-app__help__test_commands() { + local commands; commands=() + _describe -t commands 'my-app help test commands' commands "$@" +} +(( $+functions[_my-app__some_cmd_commands] )) || +_my-app__some_cmd_commands() { + local commands; commands=( +'sub_cmd:sub-subcommand' \ +'help:Print this message or the help of the given subcommand(s)' \ + ) + _describe -t commands 'my-app some_cmd commands' commands "$@" +} (( $+functions[_my-app__some_cmd__help_commands] )) || _my-app__some_cmd__help_commands() { local commands; commands=( @@ -183,26 +208,6 @@ _my-app__some_cmd__help__help_commands() { local commands; commands=() _describe -t commands 'my-app some_cmd help help commands' commands "$@" } -(( $+functions[_my-app__help__some_cmd_commands] )) || -_my-app__help__some_cmd_commands() { - local commands; commands=( -'sub_cmd:sub-subcommand' \ - ) - _describe -t commands 'my-app help some_cmd commands' commands "$@" -} -(( $+functions[_my-app__some_cmd_commands] )) || -_my-app__some_cmd_commands() { - local commands; commands=( -'sub_cmd:sub-subcommand' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'my-app some_cmd commands' commands "$@" -} -(( $+functions[_my-app__help__some_cmd__sub_cmd_commands] )) || -_my-app__help__some_cmd__sub_cmd_commands() { - local commands; commands=() - _describe -t commands 'my-app help some_cmd sub_cmd commands' commands "$@" -} (( $+functions[_my-app__some_cmd__help__sub_cmd_commands] )) || _my-app__some_cmd__help__sub_cmd_commands() { local commands; commands=() @@ -213,11 +218,6 @@ _my-app__some_cmd__sub_cmd_commands() { local commands; commands=() _describe -t commands 'my-app some_cmd sub_cmd commands' commands "$@" } -(( $+functions[_my-app__help__test_commands] )) || -_my-app__help__test_commands() { - local commands; commands=() - _describe -t commands 'my-app help test commands' commands "$@" -} (( $+functions[_my-app__test_commands] )) || _my-app__test_commands() { local commands; commands=() diff --git a/clap_complete/tests/snapshots/subcommand_last.zsh b/clap_complete/tests/snapshots/subcommand_last.zsh index 1dc63fe5..81f1572b 100644 --- a/clap_complete/tests/snapshots/subcommand_last.zsh +++ b/clap_complete/tests/snapshots/subcommand_last.zsh @@ -86,21 +86,11 @@ _my-app__bar_commands() { local commands; commands=() _describe -t commands 'my-app bar commands' commands "$@" } -(( $+functions[_my-app__help__bar_commands] )) || -_my-app__help__bar_commands() { - local commands; commands=() - _describe -t commands 'my-app help bar commands' commands "$@" -} (( $+functions[_my-app__foo_commands] )) || _my-app__foo_commands() { local commands; commands=() _describe -t commands 'my-app foo commands' commands "$@" } -(( $+functions[_my-app__help__foo_commands] )) || -_my-app__help__foo_commands() { - local commands; commands=() - _describe -t commands 'my-app help foo commands' commands "$@" -} (( $+functions[_my-app__help_commands] )) || _my-app__help_commands() { local commands; commands=( @@ -110,6 +100,16 @@ _my-app__help_commands() { ) _describe -t commands 'my-app help commands' commands "$@" } +(( $+functions[_my-app__help__bar_commands] )) || +_my-app__help__bar_commands() { + local commands; commands=() + _describe -t commands 'my-app help bar commands' commands "$@" +} +(( $+functions[_my-app__help__foo_commands] )) || +_my-app__help__foo_commands() { + local commands; commands=() + _describe -t commands 'my-app help foo commands' commands "$@" +} (( $+functions[_my-app__help__help_commands] )) || _my-app__help__help_commands() { local commands; commands=()