Skip to content

Commit

Permalink
rf remove redudnancy
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski committed Oct 28, 2024
1 parent 4380b02 commit d3bb0c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions server/v2/command_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func WithLoggerFactory(loggerFactory func(server.ConfigMap, io.Writer) (log.Logg
// --home: directory for config and data
//
// It also sets the environment variable prefix for the viper instance.
func (f *CommandFactory) EnhanceCommand(cmd *cobra.Command) {
func (f *CommandFactory) enhanceCommand(cmd *cobra.Command) {
pflags := cmd.PersistentFlags()
pflags.String(FlagLogLevel, "info", "The logging level (trace|debug|info|warn|error|fatal|panic|disabled or '*:<level>,<key>:<level>')")
pflags.String(FlagLogFormat, "plain", "The logging format (json|plain)")
Expand All @@ -127,7 +127,8 @@ func (f *CommandFactory) EnhanceCommand(cmd *cobra.Command) {
}

// EnhanceCommandContext sets the viper and logger in the command context.
func (f *CommandFactory) EnhanceCommandContext(cmd *cobra.Command) {
func (f *CommandFactory) EnchanceRootCommand(cmd *cobra.Command) {
f.enhanceCommand(cmd)
SetCmdServerContext(cmd, f.vipr, f.logger)
}

Expand All @@ -140,7 +141,7 @@ func (f *CommandFactory) ParseCommand(
rootCmd *cobra.Command,
args []string,
) (*cobra.Command, server.ConfigMap, log.Logger, error) {
f.EnhanceCommand(rootCmd)
f.enhanceCommand(rootCmd)
cmd, _, err := rootCmd.Traverse(args)
if err != nil {
return nil, nil, nil, err
Expand Down
3 changes: 1 addition & 2 deletions simapp/v2/simdv2/cmd/root_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ func NewRootCmd[T transaction.Tx](
SilenceErrors: true,
PersistentPreRunE: rootCommandPersistentPreRun(clientCtx),
}
factory.EnhanceCommand(rootCommand)
factory.EnhanceCommandContext(rootCommand)
factory.EnchanceRootCommand(rootCommand)
_, err = initRootCmd(rootCommand, logger, commandDeps)
if err != nil {
return nil, err
Expand Down

0 comments on commit d3bb0c3

Please sign in to comment.