Skip to content

Commit

Permalink
fix(complete): Improve help output
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 9, 2024
1 parent 734cac7 commit 219a191
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions clap_complete/src/dynamic/shells/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,19 @@ impl CompleteCommand {
#[command(about = None, long_about = None)]
pub struct CompleteArgs {
/// Path to write completion-registration to
#[arg(long)]
#[arg(long, value_name = "PATH")]
register: Option<std::path::PathBuf>,

#[arg(raw = true, hide = true, conflicts_with = "register")]
#[arg(
raw = true,
value_name = "ARG",
hide = true,
conflicts_with = "register"
)]
comp_words: Option<Vec<OsString>>,

/// Specify shell to complete for
#[arg(long)]
#[arg(long, value_name = "NAME")]
shell: Option<Shell>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ _exhaustive() {
return 0
;;
exhaustive__complete)
opts="-h -V --register --shell --global --help --version [COMP_WORDS]..."
opts="-h -V --register --shell --global --help --version [ARG]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ _arguments "${_arguments_options[@]}" : \
;;
(complete)
_arguments "${_arguments_options[@]}" : \
'--register=[Path to write completion-registration to]:REGISTER:_files' \
'--shell=[Specify shell to complete for]:SHELL:(bash elvish fish powershell zsh)' \
'--register=[Path to write completion-registration to]:PATH:_files' \
'--shell=[Specify shell to complete for]:NAME:(bash elvish fish powershell zsh)' \
'--global[everywhere]' \
'-h[Print help]' \
'--help[Print help]' \
Expand Down

0 comments on commit 219a191

Please sign in to comment.