version

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "version",
	Short: "Print the version string",
	Long:  `use clog -v to display the short semantic version string.`,
	Run: func(parent *cobra.Command, args []string) {
		_, file, _, _ := runtime.Caller(0)
		slog.Debug(fmt.Sprintf("run command: %s", file))

		if len(args) == 0 {
			fmt.Printf("%s (%s) %s\n",
				crayon.ColorCapitals(config.Cfg().GetString("title"), nil, nil),
				config.Cfg().GetString("app"),
				config.Cfg().GetString("clog.version.long"))
			os.Exit(0)
		}
		if args[0] == "short" {
			fmt.Println(config.Cfg().GetString("ver"))
			os.Exit(0)
		}
		if args[0] == "note" {
			fmt.Println(config.Cfg().GetString("clog.version.note"))
			os.Exit(0)
		}
		slog.Error("unknown version argument (" + args[0] + ")")
		os.Exit(1)
	},
}

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