diff --git a/scripts/completion/bash_autocomplete b/scripts/completion/bash_autocomplete index 7120a0d22..1e50939fc 100644 --- a/scripts/completion/bash_autocomplete +++ b/scripts/completion/bash_autocomplete @@ -1,7 +1,5 @@ #! /bin/bash -: ${PROG:=$(basename ${BASH_SOURCE})} - # Macs have bash3 for which the bash-completion package doesn't include # _init_completion. This is a minimal version of that function. _cli_init_completion() { @@ -31,5 +29,4 @@ _cli_bash_autocomplete() { fi } -complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete $PROG -unset PROG +complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete curio sptool diff --git a/scripts/completion/zsh_autocomplete b/scripts/completion/zsh_autocomplete index 943cf60b9..bc8802608 100644 --- a/scripts/completion/zsh_autocomplete +++ b/scripts/completion/zsh_autocomplete @@ -1,13 +1,7 @@ -#compdef program -compdef _program program +#compdef curio sptool +compdef _cli_zsh_autocomplete curio sptool -# Replace all occurrences of "program" in this file with the actual name of your -# CLI program. We recommend using Find+Replace feature of your editor. Let's say -# your CLI program is called "acme", then replace like so: -# * program => acme -# * _program => _acme - -_program() { +_cli_zsh_autocomplete() { local -a opts local cur cur=${words[-1]} @@ -25,6 +19,6 @@ _program() { } # don't run the completion function when being source-ed or eval-ed -if [ "$funcstack[1]" = "_program" ]; then - _program +if [ "$funcstack[1]" = "_cli_zsh_autocomplete" ]; then + _cli_zsh_autocomplete fi