Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
anilcse committed Jun 21, 2021
1 parent e73c64b commit 4eea4ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docs/core/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ The root command (called `rootCmd`) is what the user first types into the comman

Next is an example `rootCmd` function from the `simapp` application. It instantiates the root command, adds a [_persistent_ flag](#flags) and `PreRun` function to be run before every execution, and adds all of the necessary subcommands.

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/simapp/simd/cmd/root.go#L37-L93
+++ https://github.com/cosmos/cosmos-sdk/blob/e73c64bac3392084d47e96a5b49eb7c1b5274ea8/simapp/simd/cmd/root.go#L37-L150

`rootCmd` has a function called `initAppConfig()` which is useful for setting the application's custom configs.
By default app uses Tendermint app config template from SDK, which can be over-written via `initAppConfig()`.
Here's an example code to override default `appConfig` and `app.toml` template.

+++ https://github.com/cosmos/cosmos-sdk/blob/e73c64bac3392084d47e96a5b49eb7c1b5274ea8/simapp/simd/cmd/root.go#L84-L117

The root-level `status` and `keys` subcommands are common across most applications and do not interact with application state. The bulk of an application's functionality - what users can actually _do_ with it - is enabled by its `tx` and `query` commands.

Expand Down
6 changes: 3 additions & 3 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return err
}

customAppTemplate, customAppConfig := initConfig()
customAppTemplate, customAppConfig := initAppConfig()

return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig)
},
Expand All @@ -78,9 +78,9 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}

// initConfig helps to override default appConfig template and configs.
// initAppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func initConfig() (string, interface{}) {
func initAppConfig() (string, interface{}) {
// The following code snippet is just for reference.

// WASMConfig defines configuration for the wasm module.
Expand Down

0 comments on commit 4eea4ca

Please sign in to comment.