All Projects → hetznercloud → Cli

hetznercloud / Cli

Licence: mit
A command-line interface for Hetzner Cloud

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Cli

Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+715.87%)
Mutual labels:  command-line-tool, cli, command-line
Gitlab Cli
Create a merge request from command line in gitlab
Stars: ✭ 224 (-58.67%)
Mutual labels:  command-line-tool, cli, command-line
Miniserve
🌟 For when you really just want to serve some files over HTTP right now!
Stars: ✭ 2,894 (+433.95%)
Mutual labels:  command-line-tool, cli, command-line
Git Tidy
Tidy up stale git branches.
Stars: ✭ 137 (-74.72%)
Mutual labels:  command-line-tool, cli, command-line
Cbt
CBT - fun, fast, intuitive, compositional, statically checked builds written in Scala
Stars: ✭ 489 (-9.78%)
Mutual labels:  command-line-tool, cli, command-line
Brotab
Control your browser's tabs from the command line
Stars: ✭ 137 (-74.72%)
Mutual labels:  command-line-tool, cli, command-line
Klog
A plain-text file format and command line tool for time tracking
Stars: ✭ 222 (-59.04%)
Mutual labels:  command-line-tool, cli, command-line
Awesome Cli
A curated list of awesome resources for building immersive CLI experiences.
Stars: ✭ 104 (-80.81%)
Mutual labels:  command-line-tool, cli, command-line
Starcli
✨ Browse GitHub trending projects from your command line
Stars: ✭ 269 (-50.37%)
Mutual labels:  command-line-tool, cli, command-line
Ff
Find files (ff) by name, fast!
Stars: ✭ 257 (-52.58%)
Mutual labels:  command-line-tool, cli, command-line
Check It Out
A command line interface for Git Checkout. See branches available for checkout.
Stars: ✭ 127 (-76.57%)
Mutual labels:  command-line-tool, cli, command-line
Tsukae
🧑‍💻📊 Show off your most used shell commands
Stars: ✭ 345 (-36.35%)
Mutual labels:  command-line-tool, cli, command-line
Typin
Declarative framework for interactive CLI applications
Stars: ✭ 126 (-76.75%)
Mutual labels:  command-line-tool, cli, command-line
You Dont Need Gui
Stop relying on GUI; CLI **ROCKS**
Stars: ✭ 4,766 (+779.34%)
Mutual labels:  command-line-tool, cli, command-line
Dynein
DynamoDB CLI written in Rust.
Stars: ✭ 126 (-76.75%)
Mutual labels:  command-line-tool, cli, command-line
Dry Cli
General purpose Command Line Interface (CLI) framework for Ruby
Stars: ✭ 210 (-61.25%)
Mutual labels:  command-line-tool, cli, command-line
Ask Cli
Alexa Skills Kit Command Line Interface
Stars: ✭ 100 (-81.55%)
Mutual labels:  command-line-tool, cli, command-line
Csv2db
The CSV to database command line loader
Stars: ✭ 102 (-81.18%)
Mutual labels:  command-line-tool, cli, command-line
Websocat
Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
Stars: ✭ 3,477 (+541.51%)
Mutual labels:  command-line-tool, cli, command-line
Define
A command-line dictionary (thesaurus) app, with access to multiple sources, written in Go.
Stars: ✭ 298 (-45.02%)
Mutual labels:  command-line-tool, cli, command-line

hcloud: Command-line interface for Hetzner Cloud

Build status

hcloud is a command-line interface for interacting with Hetzner Cloud.

asciicast

Installation

You can download pre-built binaries for Linux, FreeBSD, macOS, and Windows on the releases page.

On macOS, you can install hcloud via Homebrew:

brew install hcloud

Third-party packages

There are unofficial packages maintained by third-party users. Please note that these packages aren’t supported nor maintained by Hetzner Cloud and may not always be up-to-date. Downloading the binary or building from source is still the recommended install method.

Operating System Command
Debian (>= bullseye) apt install hcloud-cli
Ubuntu (>= 19.04) apt install hcloud-cli
Arch Linux pacman -Syu hcloud
Void Linux xbps-install -Syu hcloud
Gentoo Linux emerge hcloud

Build manually

If you have Go installed, you can build and install the hcloud program with:

go get -u github.com/hetznercloud/cli/cmd/hcloud

Getting Started

  1. Visit the Hetzner Cloud Console at console.hetzner.cloud, select your project, and create a new API token.

  2. Configure the hcloud program to use your token:

    hcloud context create my-project
    
  3. You’re ready to use the program. For example, to get a list of available server types, run:

    hcloud server-type list
    

See hcloud help for a list of commands.

Shell Completion

hcloud provides completions for various shells.

Bash

To load completions into the current shell execute:

source <(hcloud completion bash)

In order to make the completions permanent, append the line above to your .bashrc.

Zsh

If shell completions are not already enabled for your environment need to enable them. Add the following line to your ~/.zshrc file:

autoload -Uz compinit; compinit

To load completions for each session execute the following commands:

mkdir -p ~/.config/hcloud/completion/zsh
hcloud completion zsh > ~/.config/hcloud/completion/zsh/_hcloud

Finally add the following line to your ~/.zshrc file, before you call the compinit function:

fpath+=(~/.config/hcloud/completion/zsh)

In the end your ~/.zshrc file should contain the following two lines in the order given here.

fpath+=(~/.config/hcloud/completion/zsh)
#  ... anything else that needs to be done before compinit
autoload -Uz compinit; compinit
# ...

You will need to start a new shell for this setup to take effect.

Fish

To load completions into the current shell execute:

hcloud completion fish | source

In order to make the completions permanent execute once:

 hcloud completion fish > ~/.config/fish/completions/hcloud.fish

Output configuration

You can control output via the -o option:

  • For list commands, you can specify -o noheader to omit the table header.

  • For list commands, you can specify -o columns=id,name to only show certain columns in the table.

  • For describe commands, you can specify -o json to get a JSON representation of the resource. The schema is identical to those in the Hetzner Cloud API which are documented at docs.hetzner.cloud.

  • For describe commands, you can specify -o format={{.ID}} to format output according to the given Go template. The template’s input is the resource’s corresponding struct in the hcloud-go library.

Configure hcloud using environment variables

You can use the following environment variables to configure hcloud:

  • HCLOUD_TOKEN
  • HCLOUD_CONTEXT
  • HCLOUD_CONFIG

When using hcloud in scripts, for example, it may be cumbersome to work with contexts. Instead of creating a context, you can set the token via the HCLOUD_TOKEN environment variable. When combined with tools like direnv, you can configure a per-directory context by setting HCLOUD_CONTEXT=my-context via .envrc.

Examples

List all servers

$ hcloud server list
ID       NAME                    STATUS    IPV4
210216   test1                   running   78.46.122.12
210729   ubuntu-8gb-nbg1-dc3-1   running   94.130.177.158

Create a server

$ hcloud server create --name test --image debian-9 --type cx11 --ssh-key demo
   7s [====================================================================] 100%
Server 325211 created

License

MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].