1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
package version
import (
"fmt"
"github.com/spf13/cobra"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/cli/internal/version"
)
func NewCommand(cli *state.State) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print version information",
Args: cobra.NoArgs,
DisableFlagsInUseLine: true,
RunE: cli.Wrap(runVersion),
}
return cmd
}
func runVersion(cli *state.State, cmd *cobra.Command, args []string) error {
fmt.Printf("hcloud %s\n", version.Version)
return nil
}
|