Skip to content

Commit

Permalink
Rename addRootFlags function
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <[email protected]>
  • Loading branch information
rubenvp8510 committed Sep 9, 2021
1 parent ff0cc79 commit 8778c27
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/es-rollover/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func main() {
},
}

addRootFlags(v, &tlsFlags, rootCmd)
addPersistentFlags(v, rootCmd, tlsFlags.AddFlags, app.AddFlags)
addSubCommand(v, rootCmd, initCommand, initCfg.AddFlags)
addSubCommand(v, rootCmd, rolloverCommand, rolloverCfg.AddFlags)
addSubCommand(v, rootCmd, lookbackCommand, lookbackCfg.AddFlags)
Expand All @@ -157,10 +157,11 @@ func addSubCommand(v *viper.Viper, rootCmd, cmd *cobra.Command, addFlags func(*f
)
}

func addRootFlags(v *viper.Viper, tlsFlags *tlscfg.ClientFlagsConfig, rootCmd *cobra.Command) {
func addPersistentFlags(v *viper.Viper, rootCmd *cobra.Command, inits ...func(*flag.FlagSet)) {
flagSet := new(flag.FlagSet)
app.AddFlags(flagSet)
tlsFlags.AddFlags(flagSet)
for i := range inits {
inits[i](flagSet)
}
rootCmd.PersistentFlags().AddGoFlagSet(flagSet)
v.BindPFlags(rootCmd.PersistentFlags())
}

0 comments on commit 8778c27

Please sign in to comment.