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