From 2bdb22d956a5cd5e6e24a19d51c2d682c93272b4 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:15:07 -0400 Subject: [PATCH] Appeler config.RegisterFlags dans rootCmd --- cmd/root.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index 3332c5c..d73c696 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,8 +5,10 @@ package cmd import ( "fmt" + "log" "os" + "git.agecem.com/agecem/bottin-ag/config" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -30,6 +32,10 @@ func init() { cobra.OnInitialize(initConfig) rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bottin-ag.yaml)") + + if err := config.RegisterFlags(rootCmd); err != nil { + log.Fatal(err) + } } // initConfig reads in config file and ENV variables if set.