version

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VersionCmd = &cobra.Command{
	Use:     "version",
	Aliases: []string{"v"},
	Args:    cobra.NoArgs,
	Short:   "Print the version",
	Long: `Output the version of the CLI.

Examples:

	> kpu version
	v1.2.3
	
	> kpu version -o json
	{"major":"v1","minor":"2","gitVersion":"v1.2.3","gitCommit":"76c01d5337fc9de6e053b4e5bafd5239c8b7a973","gitTreeState":"dirty","buildDate":"2024-04-26T11:29:39+02:00","goVersion":"go1.22.2","compiler":"gc","platform":"darwin/arm64"}

	> kpu version -o yaml
	buildDate: "2024-04-26T11:29:39+02:00"
	compiler: gc
	gitCommit: 76c01d5337fc9de6e053b4e5bafd5239c8b7a973
	gitTreeState: dirty
	gitVersion: v1.2.3
	goVersion: go1.22.2
	major: v1
	minor: "2"
	platform: darwin/arm64`,
	Run: func(cmd *cobra.Command, args []string) {
		ver := version.Get()
		switch output {
		case utils.OUTPUT_TEXT:
			cmd.Print(ver.String())
		case utils.OUTPUT_JSON:
			data, err := json.Marshal(ver)
			if err != nil {
				utils.Fatal(1, "error converting version to json: %s\n", err.Error())
			}
			cmd.Println(string(data))
		case utils.OUTPUT_YAML:
			data, err := yaml.Marshal(ver)
			if err != nil {
				utils.Fatal(1, "error converting version to yaml: %s\n", err.Error())
			}
			cmd.Print(string(data))
		default:
			utils.Fatal(1, "unknown output format '%s'", string(output))
		}
	},
}

VersionCmd represents the version command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL