my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.8 KiB

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