Annotate git hash and time in displayed version

This commit is contained in:
Ettore Di Giacinto
2020-04-12 14:37:49 +02:00
parent 579a4f20fc
commit 2f3eabc3ca
2 changed files with 17 additions and 4 deletions

View File

@@ -42,12 +42,20 @@ const (
LuetEnvPrefix = "LUET"
)
// Build time and commit information.
//
// ⚠️ WARNING: should only be set by "-ldflags".
var (
BuildTime string
BuildCommit string
)
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "luet",
Short: "Package manager for the XXth century!",
Long: `Package manager which uses containers to build packages`,
Version: LuetCLIVersion,
Version: fmt.Sprintf("%s-g%s %s", LuetCLIVersion, BuildCommit, BuildTime),
PersistentPreRun: func(cmd *cobra.Command, args []string) {
err := LoadConfig(config.LuetCfg)
if err != nil {