File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ var configCommand = &cobra.Command{
2727 firstArgument := args [0 ]
2828 configKey := firstArgument
2929 containsEquals := strings .Index (firstArgument , "=" ) > 0
30+ err := viper .ReadInConfig ()
31+ if err != nil {
32+ _ , _ = fmt .Fprintln (os .Stderr , err )
33+ }
3034 if containsEquals {
3135 // write to config
3236 configKeyValue := strings .Split (firstArgument , "=" )
@@ -37,16 +41,16 @@ var configCommand = &cobra.Command{
3741 if err != nil {
3842 _ , _ = fmt .Fprintln (os .Stderr , err )
3943 }
44+ err = viper .MergeInConfig ()
45+ if err != nil {
46+ _ , _ = fmt .Fprintln (os .Stderr , err )
47+ }
4048 err = viper .WriteConfigAs (filepath .Join (dir , configFileName ))
4149 if err != nil {
4250 _ , _ = fmt .Fprintln (os .Stderr , err )
4351 }
4452 return
4553 }
46- err := viper .ReadInConfig ()
47- if err != nil {
48- _ , _ = fmt .Fprintln (os .Stderr , err )
49- }
5054 configValue := viper .Get (configKey )
5155 switch v := configValue .(type ) {
5256 case string :
You can’t perform that action at this time.
0 commit comments