-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(simapp/v2): full AutoCLI support #22410
Changes from 8 commits
da1a2f6
72bc47f
435a84b
926246c
b720ca8
0c58a12
2c81b05
6544333
b2bde83
25af737
aca2a27
8bfa1fd
21f23d3
cf1114e
8d475af
175b81a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,20 @@ func NewRootCmd[T transaction.Tx]( | |
return nil, err | ||
} | ||
|
||
nodeCmds := nodeservice.NewNodeCommands() | ||
autoCLIModuleOpts := make(map[string]*autocliv1.ModuleOptions) | ||
autoCLIModuleOpts[nodeCmds.Name()] = nodeCmds.AutoCLIOptions() | ||
autoCliOpts, err := autocli.NewAppOptionsFromConfig( | ||
depinject.Configs(simapp.AppConfig(), depinject.Supply(runtime.GlobalConfig{})), | ||
autoCLIModuleOpts, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if err = autoCliOpts.EnhanceRootCommand(rootCommand); err != nil { | ||
return nil, err | ||
} | ||
kocubinski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
subCommand, configMap, logger, err := factory.ParseCommand(rootCommand, args) | ||
if err != nil { | ||
if errors.Is(err, pflag.ErrHelp) { | ||
|
@@ -48,7 +62,6 @@ func NewRootCmd[T transaction.Tx]( | |
} | ||
|
||
var ( | ||
autoCliOpts autocli.AppOptions | ||
moduleManager *runtime.MM[T] | ||
clientCtx client.Context | ||
simApp *simapp.SimApp[T] | ||
|
@@ -93,9 +106,7 @@ func NewRootCmd[T transaction.Tx]( | |
if err != nil { | ||
return nil, err | ||
} | ||
nodeCmds := nodeservice.NewNodeCommands() | ||
autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions) | ||
autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions() | ||
autoCliOpts.ModuleOptions = autoCLIModuleOpts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove duplicate root command enhancement The root command is being enhanced with AutoCLI options twice: once at the beginning of the function and again here. This could lead to unexpected behavior or duplicate command registration. Remove the first enhancement at lines 52-55 and keep only this final enhancement that occurs after all options are properly configured. - if err = autoCliOpts.EnhanceRootCommand(rootCommand); err != nil {
- return rootCommand, nil
- }
|
||
if err := autoCliOpts.EnhanceRootCommand(rootCommand); err != nil { | ||
return nil, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should update this, to show that
ProvideAppOptions
is required in the app config