mirror of
https://github.com/apricote/hcloud-upload-image.git
synced 2026-01-13 13:21:01 +00:00
feat(cli): docs grouping and version
This commit is contained in:
parent
d8e39159f0
commit
847b696c74
4 changed files with 29 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ $ hcloud ssh-key list -l apricote.de/created-by=hcloud-upload-image
|
|||
|
||||
This command does not handle any parallel executions of hcloud-upload-image
|
||||
and will remove in-use resources if called at the same time.`,
|
||||
GroupID: "primary",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
logger := contextlogger.From(ctx)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/apricote/hcloud-upload-image/hcloudimages/backoff"
|
||||
"github.com/apricote/hcloud-upload-image/hcloudimages/contextlogger"
|
||||
"github.com/apricote/hcloud-upload-image/internal/ui"
|
||||
"github.com/apricote/hcloud-upload-image/internal/version"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -34,6 +35,8 @@ var rootCmd = &cobra.Command{
|
|||
Long: `Manage custom OS images on Hetzner Cloud.`,
|
||||
SilenceUsage: true,
|
||||
|
||||
Version: version.Version,
|
||||
|
||||
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||
ctx := cmd.Context()
|
||||
|
||||
|
|
@ -100,4 +103,9 @@ func init() {
|
|||
rootCmd.SetErrPrefix("\033[1;31mError:")
|
||||
|
||||
rootCmd.PersistentFlags().CountVarP(&verbose, flagVerbose, "v", "verbose debug output, can be specified up to 2 times")
|
||||
|
||||
rootCmd.AddGroup(&cobra.Group{
|
||||
ID: "primary",
|
||||
Title: "Primary Commands:",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ var uploadCmd = &cobra.Command{
|
|||
Short: "Upload the specified disk image into your Hetzner Cloud project.",
|
||||
Long: `This command implements a fake "upload", by going through a real server and snapshots.
|
||||
This does cost a bit of money for the server.`,
|
||||
GroupID: "primary",
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
|
|
|
|||
19
internal/version/version.go
Normal file
19
internal/version/version.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package version
|
||||
|
||||
var (
|
||||
// version is a semver version (https://semver.org).
|
||||
version = "0.0.1" // x-release-please-version
|
||||
|
||||
// versionPrerelease is a semver version pre-release identifier (https://semver.org).
|
||||
//
|
||||
// For final releases, we set this to an empty string.
|
||||
versionPrerelease = "dev"
|
||||
|
||||
// Version of the hcloud-upload-image CLI.
|
||||
Version = func() string {
|
||||
if versionPrerelease != "" {
|
||||
return version + "-" + versionPrerelease
|
||||
}
|
||||
return version
|
||||
}()
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue