Added version print by --version flag

This commit is contained in:
ErickSkrauch 2018-01-24 01:39:40 +03:00
parent dcaa4c037d
commit caebac1753
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
3 changed files with 9 additions and 5 deletions

4
Gopkg.lock generated
View File

@ -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

View File

@ -12,6 +12,7 @@ ignored = ["elyby/minecraft-skinsystem"]
[[constraint]]
name = "github.com/spf13/cobra"
branch = "master"
[[constraint]]
name = "github.com/spf13/viper"

View File

@ -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)")
}