Created
April 30, 2022 16:32
-
-
Save igorepst/671eb238b25f212fe3f9a2e49bcc82a9 to your computer and use it in GitHub Desktop.
foo_tools.sh compdef
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
#compdef foo-tools.sh | |
_foo_tools_sh() { | |
local -a commands | |
commands=( | |
"start:Start something" | |
"stop:Stop something" | |
"install:Install something" | |
"switch:Switch to something else" | |
"kube:kube commands" | |
"open-ports:Toggle ports" | |
) | |
_arguments -C \ | |
'1:cmd:->cmds' \ | |
'*:: :->args' | |
case "$state" in | |
cmds) | |
_describe -t commands 'commands' commands | |
;; | |
*) | |
case $words[1] in | |
kube) | |
local kube_cmds=(get edit) | |
_describe -t output 'Various kube commands' kube_cmds | |
;; | |
open-ports) | |
local ports_cmds=(on off) | |
_describe -t output 'Various ports commands' ports_cmds | |
;; | |
esac | |
;; | |
esac | |
} | |
_foo_tools_sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment