From 499256492a0b763757734eba2e267d6bdddcb7d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 16 Jan 2022 21:03:37 +0100 Subject: [PATCH] config flag with -c. --- internal/config/root.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/config/root.go b/internal/config/root.go index 0223d7b2..b08534af 100644 --- a/internal/config/root.go +++ b/internal/config/root.go @@ -6,9 +6,9 @@ import ( ) type Root struct { - Debug bool - Logs bool - CfgFile string + Debug bool + Logs bool + Config string } func (Root) Init(cmd *cobra.Command) error { @@ -22,7 +22,7 @@ func (Root) Init(cmd *cobra.Command) error { return err } - cmd.PersistentFlags().String("config", "", "configuration file path") + cmd.PersistentFlags().StringP("config", "c", "", "configuration file path") if err := viper.BindPFlag("config", cmd.PersistentFlags().Lookup("config")); err != nil { return err } @@ -33,5 +33,5 @@ func (Root) Init(cmd *cobra.Command) error { func (s *Root) Set() { s.Logs = viper.GetBool("logs") s.Debug = viper.GetBool("debug") - s.CfgFile = viper.GetString("config") + s.Config = viper.GetString("config") }