summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/tugboat
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
commitaf120ab348f2e1a5a39dec035ed9dcf84189a64e (patch)
tree2a3aadd7ce1b7b771dfe3fe7c983569726c8d7ed /zsh/oh-my-zsh/plugins/tugboat
downloaddotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.gz
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.bz2
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.zip
dotfiles
Diffstat (limited to 'zsh/oh-my-zsh/plugins/tugboat')
-rw-r--r--zsh/oh-my-zsh/plugins/tugboat/README.md12
-rw-r--r--zsh/oh-my-zsh/plugins/tugboat/_tugboat106
2 files changed, 118 insertions, 0 deletions
diff --git a/zsh/oh-my-zsh/plugins/tugboat/README.md b/zsh/oh-my-zsh/plugins/tugboat/README.md
new file mode 100644
index 0000000..14f828f
--- /dev/null
+++ b/zsh/oh-my-zsh/plugins/tugboat/README.md
@@ -0,0 +1,12 @@
+# Tugboat plugin
+
+This plugin adds autocompletion for Tugboat, a command line tool for interacting with your
+[DigitalOcean droplets](https://www.digitalocean.com/products/droplets/).
+
+To use it, add it to the plugins array in your `~/.zshrc` file:
+
+```zsh
+plugins=(... tugboat)
+```
+
+Further documentation for Tugboat can be found in the [Tugboat repository](https://github.com/petems/tugboat).
diff --git a/zsh/oh-my-zsh/plugins/tugboat/_tugboat b/zsh/oh-my-zsh/plugins/tugboat/_tugboat
new file mode 100644
index 0000000..6bf7369
--- /dev/null
+++ b/zsh/oh-my-zsh/plugins/tugboat/_tugboat
@@ -0,0 +1,106 @@
+#compdef tugboat
+#autoload
+
+# Tugboat zsh autocompletion
+
+
+local -a _commands
+_commands=(
+ 'add-key:[NAME] Upload an ssh public key.'
+ 'authorize:Authorize a DigitalOcean account with tugboat.'
+ 'create:[NAME] Create a droplet.'
+ 'destroy:[FUZZY_NAME] Destroy a droplet.'
+ 'destroy_image:[FUZZY_NAME] Destroy an image.'
+ 'droplets:Retrieve a list of your droplets.'
+ 'halt:[FUZZY_NAME] Shutdown a droplet.'
+ 'help:[COMMAND] Describe commands or a specific command.'
+ 'images:Retrieve a list of your images.'
+ 'info:[FUZZY_NAME] [OPTIONS] Show a droplets information.'
+ 'info_image:[FUZZY_NAME] [OPTIONS] Show an images information.'
+ 'keys:Show available SSH keys.'
+ 'password-reset:[FUZZY_NAME] Reset root password.'
+ 'rebuild:[FUZZY_NAME] [IMAGE_NAME] Rebuild a droplet.'
+ 'regions:Show regions.'
+ 'resize:[FUZZY_NAME -s, --size=N] Resize a droplet.'
+ 'restart:[FUZZY_NAME] Restart a droplet.'
+ 'sizes:Show available droplet sizes.'
+ 'snapshot:[SNAPSHOT_NAME] [FUZZY_NAME] [OPTIONS] Queue a snapshot of the droplet.'
+ 'ssh:[FUZZY_NAME] SSH into a droplet.'
+ 'start:[FUZZY_NAME] Start a droplet.'
+ 'verify:Check your DigitalOcean credentials.'
+ 'version:Show version.'
+ 'wait:[FUZZY_NAME] Wait for a droplet to reach a state.'
+)
+
+local -a _create_arguments
+_create_arguments=(
+ '-s:[--size=N] The size_id of the droplet'
+ '-i:[--image=N] The image_id of the droplet'
+ '-r:[--region=N] The region_id of the droplet'
+ '-k:[--keys=KEYS] A comma separated list of SSH key ids to add to the droplet'
+ '-p:[--private-networking] Enable private networking on the droplet'
+ '-b:[--backups-enabled] Enable backups on the droplet'
+ '-q:[--quiet]'
+)
+
+__task_list ()
+{
+ local expl
+ declare -a tasks
+
+ 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)
+
+ _wanted tasks expl 'help' compadd $arguments
+}
+
+__droplets_list ()
+{
+ _wanted application expl 'command' compadd $(command tugboat droplets | cut -d " " -f1)
+}
+
+__tugboat-create ()
+{
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+
+ _arguments -C \
+ ':command:->command' \
+ '*::options:->options'
+
+ case $state in
+ (command)
+ _describe -t commands "gem subcommand" _create_arguments
+ return
+ ;;
+ esac
+}
+
+local curcontext="$curcontext" state line
+typeset -A opt_args
+
+_arguments -C \
+ ':command:->command' \
+ '*::options:->options'
+
+case $state in
+ (command)
+ _describe -t commands "gem subcommand" _commands
+ return
+ ;;
+
+ (options)
+ case $line[1] in
+ (help)
+ _arguments ':feature:__task_list'
+ ;;
+
+ (ssh)
+ _arguments ':feature:__droplets_list'
+ ;;
+
+ (create)
+ _arguments ':feature:__tugboat-create'
+ ;;
+ esac
+ ;;
+esac