26 lines
486 B
Go
26 lines
486 B
Go
package cmd
|
|
|
|
import (
|
|
"log/slog"
|
|
"runtime"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var CurrentVersion = "development"
|
|
|
|
func VersionCommand() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "version",
|
|
Short: "Prints the version of the CLI",
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
Run: func(*cobra.Command, []string) {
|
|
slog.Info("BuildR version",
|
|
slog.String("current_version", CurrentVersion),
|
|
slog.String("go_version", runtime.Version()),
|
|
)
|
|
},
|
|
}
|
|
}
|