From e3143887410863c934db2728632a403cc2fbd434 Mon Sep 17 00:00:00 2001 From: Sandeep Nuthalapati <3803259+deepu9@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:05:55 +1000 Subject: [PATCH] feat: [#59] cmd implement version flag (#66) * feat: [#59] cmd implement version flag Set the version field of the cobra command * fix: [#59] cmd implement version flag Update the main file to get the version from the cmd package. --- cmd/root.go | 4 +++- main.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 509fe7c..fe5f0a4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,11 +4,13 @@ import ( "github.com/spf13/cobra" ) +var Version = "0.7.3" + var rootCmd = &cobra.Command{ Use: "vib", Short: "Vib is a tool to build container images from recipes using modules", Long: "Vib is a tool to build container images from YAML recipes using modules to define the steps to build the image.", - Version: "0.7.3", + Version: Version, } func init() { diff --git a/main.go b/main.go index fc05671..82499ea 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ import ( ) var ( - Version = "0.6.2" + Version = cmd.Version ) func main() {