fix(cli): completion requires HCLOUD_TOKEN (#19)

The current setup of the CLI requires the user to set HCLOUD_TOKEN for
every single invocation of the binary. Even if we just want to
autocomplete some arguments or even generate the completion scripts in
CI.

This fixes the bug by only initializing the hcloud-go client in the
"cleanup" and "upload" subcommands.
This commit is contained in:
Julian Tölle 2024-05-10 18:06:38 +02:00 committed by GitHub
parent f7dc501b2f
commit bb2ca48200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 6 deletions

2
go.mod
View file

@ -3,7 +3,7 @@ module github.com/apricote/hcloud-upload-image
go 1.22.2
require (
github.com/apricote/hcloud-upload-image/hcloudimages v0.0.0
github.com/apricote/hcloud-upload-image/hcloudimages v0.2.0
github.com/hetznercloud/hcloud-go/v2 v2.8.0
github.com/spf13/cobra v1.8.0
)