Created
April 3, 2018 08:26
-
-
Save camathieu/dce2d32dc0b498e2eaae20f55b370758 to your computer and use it in GitHub Desktop.
bash completion for supervisorctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pfreixes, 2012-07-27 | |
# Add to /etc/bash_completion.d/supervisorctl | |
_supervisor() | |
{ | |
local cur prev opts base | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
# | |
# The basic options we'll complete. | |
# | |
opts="add clear fg open quit remove restart start stop update avail exit maintail pid reload reread shutdown status tail version" | |
# | |
# Complete the arguments to some of the basic commands. | |
# | |
case "${prev}" in | |
start|stop|restart|status|tail) | |
local process=$(for x in `supervisorctl avail | awk '{print $1}'`; do echo ${x} ; done ) | |
COMPREPLY=( $(compgen -W "${process}" -- ${cur}) ) | |
return 0 | |
;; | |
*) | |
;; | |
esac | |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) | |
return 0 | |
} | |
hash supervisorctl && complete -F _supervisor supervisorctl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment