Add zsh shell completion script
This commit is contained in:
@@ -26,6 +26,15 @@ set SPRING_HOME to point to a specific installation. You should also add SPRING
|
||||
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
|
||||
--------------------------
|
||||
To test if you have successfully install the CLI you can run the following command:
|
||||
|
||||
29
spring-boot-cli/src/main/content/shell-completion/zsh/_spring
Executable file
29
spring-boot-cli/src/main/content/shell-completion/zsh/_spring
Executable file
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user