From caebac1753f41d5ccc3e9082fe4358133b8fe139 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 24 Jan 2018 01:39:40 +0300 Subject: [PATCH] Added version print by --version flag --- Gopkg.lock | 4 ++-- Gopkg.toml | 1 + cmd/root.go | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index bca5153..751a168 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -143,7 +143,7 @@ branch = "master" name = "github.com/spf13/cobra" packages = ["."] - revision = "3c0b56b677e04926dfa835a1b3f11cd4f62f076e" + revision = "0c34d16c3123764e413b9ed982ada58b1c3d53ea" [[projects]] branch = "master" @@ -203,6 +203,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "b85cbbca8b4283a0977ee92789c9beee468f2d355da5dfa28a4176934548f6f3" + inputs-digest = "85c318cc67a4e78dd3608297ae189cc70b07968ba6e0e1a04cc21b264fddf1eb" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 8b317d5..2364f3a 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -12,6 +12,7 @@ ignored = ["elyby/minecraft-skinsystem"] [[constraint]] name = "github.com/spf13/cobra" + branch = "master" [[constraint]] name = "github.com/spf13/viper" diff --git a/cmd/root.go b/cmd/root.go index d4b0df2..e78a97e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,6 +4,8 @@ import ( "fmt" "os" + "elyby/minecraft-skinsystem/bootstrap" + "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -11,8 +13,9 @@ import ( var cfgFile string var RootCmd = &cobra.Command{ - Use: "", - Short: "Nothing here", + Use: "", + Short: "Nothing here", + Version: bootstrap.GetVersion(), } // Execute adds all child commands to the root command and sets flags appropriately. @@ -24,7 +27,7 @@ func Execute() { } } -func init() { +func init() { cobra.OnInitialize(initConfig) RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.test.yaml)") }