834fbf371196b6136dacf113b90713c2f2f42a6f

Author
Arbian Shkodra <97307964+arbianshkodra@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(hcloud): add plugin for Hetzner Cloud CLI (#13473)

Add a new plugin for the Hetzner Cloud CLI (hcloud) with:
- Auto-completion support
- Comprehensive aliases for all major hcloud commands
- Context management shortcuts
- Server, volume, network, and firewall management aliases
- Load balancer and certificate management shortcuts
- Documentation with complete alias reference

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/hcloud/README.md b/plugins/hcloud/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..6cac675c5dbf88231e1b0514b5cdc7e59e4837db
  4--- /dev/null
  5+++ b/plugins/hcloud/README.md
  6@@ -0,0 +1,143 @@
  7+# hcloud plugin
  8+
  9+This plugin adds completion for the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli),
 10+as well as some aliases for common hcloud commands.
 11+
 12+To use it, add `hcloud` to the plugins array in your zshrc file:
 13+
 14+```zsh
 15+plugins=(... hcloud)
 16+```
 17+
 18+## Aliases
 19+
 20+| Alias      | Command                                   | Description                                                   |
 21+| :--------- | :---------------------------------------- | :------------------------------------------------------------ |
 22+| hc         | `hcloud`                                  | The hcloud command                                            |
 23+|            |                                           | **Context Management**                                        |
 24+| hcctx      | `hcloud context`                          | Manage contexts                                               |
 25+| hcctxls    | `hcloud context list`                     | List all contexts                                             |
 26+| hcctxu     | `hcloud context use`                      | Use a context                                                 |
 27+| hcctxc     | `hcloud context create`                   | Create a new context                                          |
 28+| hcctxd     | `hcloud context delete`                   | Delete a context                                              |
 29+| hcctxa     | `hcloud context active`                   | Show active context                                           |
 30+|            |                                           | **Server Management**                                         |
 31+| hcs        | `hcloud server`                           | Manage servers                                                |
 32+| hcsl       | `hcloud server list`                      | List all servers                                              |
 33+| hcsc       | `hcloud server create`                    | Create a server                                               |
 34+| hcsd       | `hcloud server delete`                    | Delete a server                                               |
 35+| hcsdesc    | `hcloud server describe`                  | Describe a server                                             |
 36+| hcspoff    | `hcloud server poweroff`                  | Power off a server                                            |
 37+| hcspon     | `hcloud server poweron`                   | Power on a server                                             |
 38+| hcsr       | `hcloud server reboot`                    | Reboot a server                                               |
 39+| hcsreset   | `hcloud server reset`                     | Reset a server                                                |
 40+| hcssh      | `hcloud server ssh`                       | SSH into a server                                             |
 41+| hcse       | `hcloud server enable-rescue`             | Enable rescue mode for a server                               |
 42+| hcsdr      | `hcloud server disable-rescue`            | Disable rescue mode for a server                              |
 43+| hcsip      | `hcloud server ip`                        | Manage server IPs                                             |
 44+| hcsa       | `hcloud server attach-iso`                | Attach an ISO to a server                                     |
 45+| hcsda      | `hcloud server detach-iso`                | Detach an ISO from a server                                   |
 46+| hcscip     | `hcloud server change-type`               | Change server type                                            |
 47+|            |                                           | **Volume Management**                                         |
 48+| hcv        | `hcloud volume`                           | Manage volumes                                                |
 49+| hcvl       | `hcloud volume list`                      | List all volumes                                              |
 50+| hcvc       | `hcloud volume create`                    | Create a volume                                               |
 51+| hcvd       | `hcloud volume delete`                    | Delete a volume                                               |
 52+| hcvdesc    | `hcloud volume describe`                  | Describe a volume                                             |
 53+| hcva       | `hcloud volume attach`                    | Attach a volume to a server                                   |
 54+| hcvda      | `hcloud volume detach`                    | Detach a volume from a server                                 |
 55+| hcvr       | `hcloud volume resize`                    | Resize a volume                                               |
 56+|            |                                           | **Network Management**                                        |
 57+| hcn        | `hcloud network`                          | Manage networks                                               |
 58+| hcnl       | `hcloud network list`                     | List all networks                                             |
 59+| hcnc       | `hcloud network create`                   | Create a network                                              |
 60+| hcnd       | `hcloud network delete`                   | Delete a network                                              |
 61+| hcndesc    | `hcloud network describe`                 | Describe a network                                            |
 62+| hcnas      | `hcloud network add-subnet`               | Add a subnet to a network                                     |
 63+| hcnds      | `hcloud network delete-subnet`            | Delete a subnet from a network                                |
 64+| hcnar      | `hcloud network add-route`                | Add a route to a network                                      |
 65+| hcndr      | `hcloud network delete-route`             | Delete a route from a network                                 |
 66+|            |                                           | **Floating IP Management**                                    |
 67+| hcfip      | `hcloud floating-ip`                      | Manage floating IPs                                           |
 68+| hcfipl     | `hcloud floating-ip list`                 | List all floating IPs                                         |
 69+| hcfipc     | `hcloud floating-ip create`               | Create a floating IP                                          |
 70+| hcfipd     | `hcloud floating-ip delete`               | Delete a floating IP                                          |
 71+| hcfipdesc  | `hcloud floating-ip describe`             | Describe a floating IP                                        |
 72+| hcfipa     | `hcloud floating-ip assign`               | Assign a floating IP to a server                              |
 73+| hcfipua    | `hcloud floating-ip unassign`             | Unassign a floating IP from a server                          |
 74+|            |                                           | **SSH Key Management**                                        |
 75+| hcsk       | `hcloud ssh-key`                          | Manage SSH keys                                               |
 76+| hcskl      | `hcloud ssh-key list`                     | List all SSH keys                                             |
 77+| hcskc      | `hcloud ssh-key create`                   | Create an SSH key                                             |
 78+| hcskd      | `hcloud ssh-key delete`                   | Delete an SSH key                                             |
 79+| hcskdesc   | `hcloud ssh-key describe`                 | Describe an SSH key                                           |
 80+| hcsku      | `hcloud ssh-key update`                   | Update an SSH key                                             |
 81+|            |                                           | **Image Management**                                          |
 82+| hci        | `hcloud image`                            | Manage images                                                 |
 83+| hcil       | `hcloud image list`                       | List all images                                               |
 84+| hcid       | `hcloud image delete`                     | Delete an image                                               |
 85+| hcidesc    | `hcloud image describe`                   | Describe an image                                             |
 86+| hciu       | `hcloud image update`                     | Update an image                                               |
 87+|            |                                           | **Firewall Management**                                       |
 88+| hcfw       | `hcloud firewall`                         | Manage firewalls                                              |
 89+| hcfwl      | `hcloud firewall list`                    | List all firewalls                                            |
 90+| hcfwc      | `hcloud firewall create`                  | Create a firewall                                             |
 91+| hcfwd      | `hcloud firewall delete`                  | Delete a firewall                                             |
 92+| hcfwdesc   | `hcloud firewall describe`                | Describe a firewall                                           |
 93+| hcfwar     | `hcloud firewall add-rule`                | Add a rule to a firewall                                      |
 94+| hcfwdr     | `hcloud firewall delete-rule`             | Delete a rule from a firewall                                 |
 95+| hcfwas     | `hcloud firewall apply-to-resource`       | Apply a firewall to a resource                                |
 96+| hcfwrs     | `hcloud firewall remove-from-resource`    | Remove a firewall from a resource                             |
 97+|            |                                           | **Load Balancer Management**                                  |
 98+| hclb       | `hcloud load-balancer`                    | Manage load balancers                                         |
 99+| hclbl      | `hcloud load-balancer list`               | List all load balancers                                       |
100+| hclbc      | `hcloud load-balancer create`             | Create a load balancer                                        |
101+| hclbd      | `hcloud load-balancer delete`             | Delete a load balancer                                        |
102+| hclbdesc   | `hcloud load-balancer describe`           | Describe a load balancer                                      |
103+| hclbu      | `hcloud load-balancer update`             | Update a load balancer                                        |
104+| hclbas     | `hcloud load-balancer add-service`        | Add a service to a load balancer                              |
105+| hclbds     | `hcloud load-balancer delete-service`     | Delete a service from a load balancer                         |
106diff --git a/plugins/hcloud/hcloud.plugin.zsh b/plugins/hcloud/hcloud.plugin.zsh
107new file mode 100644
108index 0000000000000000000000000000000000000000..3b1d4321e534966e4e4aa62e6dc0ccaa30becc1c
109--- /dev/null
110+++ b/plugins/hcloud/hcloud.plugin.zsh
111@@ -0,0 +1,129 @@
112+# hcloud plugin for oh-my-zsh
113+# Hetzner Cloud CLI: https://github.com/hetznercloud/cli
114+
115+if (( ! $+commands[hcloud] )); then
116+  return
117+fi
118+
119+# If the completion file doesn't exist yet, we need to autoload it and
120+# bind it to `hcloud`. Otherwise, compinit will have already done that.
121+if [[ ! -f "$ZSH_CACHE_DIR/completions/_hcloud" ]]; then
122+  typeset -g -A _comps
123+  autoload -Uz _hcloud
124+  _comps[hcloud]=_hcloud
125+fi
126+
127+hcloud completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_hcloud" &|
128+
129+# Main alias
130+alias hc='hcloud'
131+
132+# Context management
133+alias hcctx='hcloud context'
134+alias hcctxls='hcloud context list'
135+alias hcctxu='hcloud context use'
136+alias hcctxc='hcloud context create'
137+alias hcctxd='hcloud context delete'
138+alias hcctxa='hcloud context active'
139+
140+# Server management
141+alias hcs='hcloud server'
142+alias hcsl='hcloud server list'
143+alias hcsc='hcloud server create'
144+alias hcsd='hcloud server delete'
145+alias hcsdesc='hcloud server describe'
146+alias hcspoff='hcloud server poweroff'
147+alias hcspon='hcloud server poweron'
148+alias hcsr='hcloud server reboot'
149+alias hcsreset='hcloud server reset'
150+alias hcssh='hcloud server ssh'
151+alias hcse='hcloud server enable-rescue'
152+alias hcsdr='hcloud server disable-rescue'
153+alias hcsip='hcloud server ip'
154+
155+# Server actions
156+alias hcsa='hcloud server attach-iso'
157+alias hcsda='hcloud server detach-iso'
158+alias hcscip='hcloud server change-type'
159+
160+# Volume management
161+alias hcv='hcloud volume'
162+alias hcvl='hcloud volume list'
163+alias hcvc='hcloud volume create'
164+alias hcvd='hcloud volume delete'
165+alias hcvdesc='hcloud volume describe'
166+alias hcva='hcloud volume attach'
167+alias hcvda='hcloud volume detach'
168+alias hcvr='hcloud volume resize'
169+
170+# Network management
171+alias hcn='hcloud network'
172+alias hcnl='hcloud network list'
173+alias hcnc='hcloud network create'
174+alias hcnd='hcloud network delete'
175+alias hcndesc='hcloud network describe'
176+alias hcnas='hcloud network add-subnet'
177+alias hcnds='hcloud network delete-subnet'
178+alias hcnar='hcloud network add-route'
179+alias hcndr='hcloud network delete-route'
180+
181+# Floating IP management
182+alias hcfip='hcloud floating-ip'
183+alias hcfipl='hcloud floating-ip list'
184+alias hcfipc='hcloud floating-ip create'
185+alias hcfipd='hcloud floating-ip delete'
186+alias hcfipdesc='hcloud floating-ip describe'
187+alias hcfipa='hcloud floating-ip assign'
188+alias hcfipua='hcloud floating-ip unassign'
189+
190+# SSH key management
191+alias hcsk='hcloud ssh-key'
192+alias hcskl='hcloud ssh-key list'
193+alias hcskc='hcloud ssh-key create'
194+alias hcskd='hcloud ssh-key delete'
195+alias hcskdesc='hcloud ssh-key describe'
196+alias hcsku='hcloud ssh-key update'
197+
198+# Image management
199+alias hci='hcloud image'
200+alias hcil='hcloud image list'
201+alias hcid='hcloud image delete'
202+alias hcidesc='hcloud image describe'
203+alias hciu='hcloud image update'
204+
205+# Firewall management
206+alias hcfw='hcloud firewall'
207+alias hcfwl='hcloud firewall list'
208+alias hcfwc='hcloud firewall create'
209+alias hcfwd='hcloud firewall delete'
210+alias hcfwdesc='hcloud firewall describe'