Skip to content

Commit

Permalink
godoc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samricotta committed Oct 23, 2023
1 parent 84b469f commit 0e66412
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 0 additions & 6 deletions simapp/simd/cmd/commands.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"context"
"errors"
"io"
"os"
Expand All @@ -27,7 +26,6 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
Expand All @@ -40,14 +38,10 @@ func initRootCmd(
interfaceRegistry codectypes.InterfaceRegistry,
appCodec codec.Codec,
basicManager module.BasicManager,
extraInfo version.ExtraInfo,
) {
cfg := sdk.GetConfig()
cfg.Seal()

cmdContext := context.WithValue(context.Background(), version.ContextKey{}, extraInfo)
rootCmd.SetContext(cmdContext)

rootCmd.AddCommand(
genutilcli.InitCmd(basicManager),
NewTestnetCmd(basicManager, banktypes.GenesisBalancesIterator{}),
Expand Down
2 changes: 1 addition & 1 deletion simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func NewRootCmd() *cobra.Command {
},
}

initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager, nil)
initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager)

// autocli opts
customClientTemplate, customClientConfig := initClientConfig()
Expand Down
2 changes: 1 addition & 1 deletion simapp/simd/cmd/root_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func NewRootCmd() *cobra.Command {
},
}

initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager, nil)
initRootCmd(rootCmd, clientCtx.TxConfig, clientCtx.InterfaceRegistry, clientCtx.Codec, moduleBasicManager)

if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
panic(err)
Expand Down
6 changes: 6 additions & 0 deletions version/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const (
)

// NewVersionCommand returns a CLI command to interactively print the application binary version information.
// Note: When seeking to add the extra info to the context
// The below can be added to the initRootCmd to include the extraInfo field
//
// cmdContext := context.WithValue(context.Background(), version.ContextKey{}, extraInfo)
// rootCmd.SetContext(cmdContext)
func NewVersionCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Expand All @@ -28,6 +33,7 @@ func NewVersionCommand() *cobra.Command {
return nil
}

// Extract and set extra information from the context
extraInfo := extraInfoFromContext(cmd)
verInfo.ExtraInfo = &extraInfo

Expand Down

0 comments on commit 0e66412

Please sign in to comment.