Add zsh shell completion script
This commit is contained in:
parent
fe0dd8e08f
commit
077cd662e7
|
|
@ -26,6 +26,15 @@ set SPRING_HOME to point to a specific installation. You should also add SPRING
|
||||||
to your PATH environment variable.
|
to your PATH environment variable.
|
||||||
|
|
||||||
|
|
||||||
|
Shell Completion
|
||||||
|
----------------
|
||||||
|
Shell auto-completion scripts are provided for BASH and ZSH. Add symlinks to the appropriate
|
||||||
|
location for your environment. For example, something like:
|
||||||
|
|
||||||
|
ln -s ./shell-completion/bash/spring /etc/bash_completion.d/spring
|
||||||
|
ln -s ./shell-completion/zsh/_spring /usr/local/share/zsh/site-functions/_spring
|
||||||
|
|
||||||
|
|
||||||
Checking Your Installation
|
Checking Your Installation
|
||||||
--------------------------
|
--------------------------
|
||||||
To test if you have successfully install the CLI you can run the following command:
|
To test if you have successfully install the CLI you can run the following command:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
#compdef spring 'spring'
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
_spring() {
|
||||||
|
|
||||||
|
local cword
|
||||||
|
let cword=CURRENT-1
|
||||||
|
|
||||||
|
local hints
|
||||||
|
hints=()
|
||||||
|
|
||||||
|
local reply
|
||||||
|
while read -r line; do
|
||||||
|
reply=`echo "$line" | awk '{printf $1 ":"; for (i=2; i<NF; i++) printf $i " "; print $NF}'`
|
||||||
|
hints+=("$reply")
|
||||||
|
done < <(spring hint ${cword} ${words[*]})
|
||||||
|
|
||||||
|
if ((cword == 1)) {
|
||||||
|
_describe -t commands 'commands' hints
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_describe -t options 'options' hints
|
||||||
|
_files
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_spring "$@"
|
||||||
Loading…
Reference in New Issue