Created
May 4, 2011 04:32
-
-
Save dann/954758 to your computer and use it in GitHub Desktop.
dotcloud 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 dotcloud | |
typeset -A opt_args | |
local context state line | |
_arguments -C \ | |
'(- 1 *)'{-h,--help}'[prints help]' \ | |
'1: :->cmds' \ | |
'(1 *): :->args' && return 0 | |
case $state in | |
cmds) | |
local -a cmds | |
cmds=(status info run logs deploy setup list alias ssh destroy push rollback create restart ) | |
_describe -t commands 'dotcloud command' cmds && ret=0 | |
;; | |
args) | |
case $line[1] in | |
(status | info | ssh | logs | push| restart | rollback ) | |
local -a services | |
services=(system $(_call_program commands dotcloud list 2>/dev/null | grep "-" | awk '{print $2}' )) | |
_wanted services expl 'service' compadd $services && ret=0 | |
;; | |
*) | |
(( ret )) && _message 'no more arguments' | |
;; | |
esac | |
;; | |
esac | |
return ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment