fix(complete): Don't provide help output for user

We shouldn't be injecting help when being flattened.

Unsure why this made tests fail inconsistentkly between CI and local
This commit is contained in:
Ed Page 2024-01-15 12:51:45 -06:00
parent a04e4550b9
commit 6fcba9821d
4 changed files with 7 additions and 5 deletions

View file

@ -19,6 +19,7 @@ use crate::dynamic::Completer as _;
#[derive(clap::Subcommand)]
#[allow(missing_docs)]
#[derive(Clone, Debug)]
#[command(about = None, long_about = None)]
pub enum CompleteCommand {
/// Register shell completions for this program
#[command(hide = true)]
@ -31,6 +32,7 @@ pub enum CompleteCommand {
#[command(group = clap::ArgGroup::new("complete").multiple(true).conflicts_with("register"))]
#[allow(missing_docs)]
#[derive(Clone, Debug)]
#[command(about = None, long_about = None)]
pub struct CompleteArgs {
/// Specify shell to complete for
#[arg(long)]

View file

@ -22,8 +22,8 @@ set edit:completion:arg-completer[exhaustive] = {|@words|
&'exhaustive'= {
cand --generate 'generate'
cand --global 'everywhere'
cand -h 'Print help (see more with ''--help'')'
cand --help 'Print help (see more with ''--help'')'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
cand --version 'Print version'
cand action 'action'

View file

@ -1,6 +1,6 @@
complete -c exhaustive -n "__fish_use_subcommand" -l generate -d 'generate' -r -f -a "{bash '',elvish '',fish '',powershell '',zsh ''}"
complete -c exhaustive -n "__fish_use_subcommand" -l global -d 'everywhere'
complete -c exhaustive -n "__fish_use_subcommand" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c exhaustive -n "__fish_use_subcommand" -s h -l help -d 'Print help'
complete -c exhaustive -n "__fish_use_subcommand" -s V -l version -d 'Print version'
complete -c exhaustive -n "__fish_use_subcommand" -f -a "action"
complete -c exhaustive -n "__fish_use_subcommand" -f -a "quote"

View file

@ -17,8 +17,8 @@ _exhaustive() {
_arguments "${_arguments_options[@]}" \
'--generate=[generate]:SHELL:(bash elvish fish powershell zsh)' \
'--global[everywhere]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_exhaustive_commands" \