2023-04-11 20:30:48 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2023-08-23 18:14:02 +00:00
|
|
|
"log/slog"
|
2023-04-11 20:30:48 +00:00
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2023-05-01 08:15:53 +00:00
|
|
|
var CurrentVersion = "development"
|
2023-04-11 20:30:48 +00:00
|
|
|
|
2023-05-01 08:15:53 +00:00
|
|
|
func VersionCommand() *cobra.Command {
|
|
|
|
return &cobra.Command{
|
2023-04-11 20:30:48 +00:00
|
|
|
Use: "version",
|
2023-05-01 08:15:53 +00:00
|
|
|
Short: "Prints the version of the CLI",
|
2023-04-11 20:30:48 +00:00
|
|
|
SilenceUsage: true,
|
|
|
|
SilenceErrors: true,
|
2023-05-01 08:15:53 +00:00
|
|
|
Run: func(*cobra.Command, []string) {
|
|
|
|
slog.Info("BuildR version",
|
|
|
|
slog.String("current_version", CurrentVersion),
|
|
|
|
slog.String("go_version", runtime.Version()),
|
|
|
|
)
|
|
|
|
},
|
2023-04-11 20:30:48 +00:00
|
|
|
}
|
|
|
|
}
|