]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/tugboat/_tugboat
initial
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / tugboat / _tugboat
1 #compdef tugboat
2 #autoload
3
4 # Tugboat zsh autocompletion
5
6
7 local -a _commands
8 _commands=(
9   'add-key:[NAME] Upload an ssh public key.'
10   'authorize:Authorize a DigitalOcean account with tugboat.'
11   'create:[NAME] Create a droplet.'
12   'destroy:[FUZZY_NAME] Destroy a droplet.'
13   'destroy_image:[FUZZY_NAME] Destroy an image.'
14   'droplets:Retrieve a list of your droplets.'
15   'halt:[FUZZY_NAME] Shutdown a droplet.'
16   'help:[COMMAND] Describe commands or a specific command.'
17   'images:Retrieve a list of your images.'
18   'info:[FUZZY_NAME] [OPTIONS] Show a droplets information.'
19   'info_image:[FUZZY_NAME] [OPTIONS] Show an images information.'
20   'keys:Show available SSH keys.'
21   'password-reset:[FUZZY_NAME] Reset root password.'
22   'rebuild:[FUZZY_NAME] [IMAGE_NAME] Rebuild a droplet.'
23   'regions:Show regions.'
24   'resize:[FUZZY_NAME -s, --size=N] Resize a droplet.'
25   'restart:[FUZZY_NAME] Restart a droplet.'
26   'sizes:Show available droplet sizes.'
27   'snapshot:[SNAPSHOT_NAME] [FUZZY_NAME] [OPTIONS] Queue a snapshot of the droplet.'
28   'ssh:[FUZZY_NAME] SSH into a droplet.'
29   'start:[FUZZY_NAME] Start a droplet.'
30   'verify:Check your DigitalOcean credentials.'
31   'version:Show version.'
32   'wait:[FUZZY_NAME] Wait for a droplet to reach a state.'
33 )
34
35 local -a _create_arguments
36 _create_arguments=(
37   '-s:[--size=N] The size_id of the droplet'
38   '-i:[--image=N] The image_id of the droplet'
39   '-r:[--region=N] The region_id of the droplet'
40   '-k:[--keys=KEYS] A comma separated list of SSH key ids to add to the droplet'
41   '-p:[--private-networking] Enable private networking on the droplet'
42   '-b:[--backups-enabled] Enable backups on the droplet'
43   '-q:[--quiet]'
44 )
45
46 __task_list ()
47 {
48   local expl
49   declare -a tasks
50
51   arguments=(add-key authorize create destroy destroy_image droplets halt help images info info_image keys password-reset rebuild regions resize restart sizes snapshot ssh start verify version wait)
52
53   _wanted tasks expl 'help' compadd $arguments
54 }
55
56 __droplets_list ()
57 {
58     _wanted application expl 'command' compadd $(command tugboat droplets | cut -d " " -f1)
59 }
60
61 __tugboat-create ()
62 {
63     local curcontext="$curcontext" state line
64     typeset -A opt_args
65
66     _arguments -C \
67         ':command:->command' \
68         '*::options:->options'
69
70     case $state in
71         (command)
72             _describe -t commands "gem subcommand" _create_arguments
73             return
74         ;;
75     esac
76 }
77
78 local curcontext="$curcontext" state line
79 typeset -A opt_args
80
81 _arguments -C \
82     ':command:->command' \
83     '*::options:->options'
84
85 case $state in
86   (command)
87     _describe -t commands "gem subcommand" _commands
88     return
89   ;;
90
91   (options)
92     case $line[1] in
93       (help)
94         _arguments ':feature:__task_list'
95       ;;
96
97       (ssh)
98         _arguments ':feature:__droplets_list'
99       ;;
100
101       (create)
102         _arguments ':feature:__tugboat-create'
103       ;;
104     esac
105   ;;
106 esac