Skip to content

Commit

Permalink
Merge PR cosmos#6651: More CLI cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Jul 8, 2020
1 parent 5226bfe commit 2d6d764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
13 changes: 5 additions & 8 deletions simd/cmd/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import (
)

const (
flagClientHome = "home-client"
flagVestingStart = "vesting-start-time"
flagVestingEnd = "vesting-end-time"
flagVestingAmt = "vesting-amount"
)

// AddGenesisAccountCmd returns add-genesis-account cobra Command.
func AddGenesisAccountCmd(defaultClientHome string) *cobra.Command {
func AddGenesisAccountCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
Short: "Add a genesis account to genesis.json",
Expand All @@ -48,14 +47,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa

config.SetRoot(clientCtx.HomeDir)

keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
clientHome, _ := cmd.Flags().GetString(flagClientHome)

addr, err := sdk.AccAddressFromBech32(args[0])
inBuf := bufio.NewReader(cmd.InOrStdin())
if err != nil {
inBuf := bufio.NewReader(cmd.InOrStdin())
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)

// attempt to lookup address from Keybase if no address was provided
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientHome, inBuf)
kb, err := keyring.New(sdk.KeyringServiceName(), keyringBackend, clientCtx.HomeDir, inBuf)
if err != nil {
return err
}
Expand Down Expand Up @@ -160,7 +158,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
}

cmd.Flags().String(flags.FlagHome, "", "The application home directory")
cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory")
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
Expand Down
10 changes: 5 additions & 5 deletions simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ func init() {

rootCmd.AddCommand(
genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}),
genutilcli.MigrateGenesisCmd(),
genutilcli.GenTxCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
genutilcli.GenTxCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
genutilcli.ValidateGenesisCmd(simapp.ModuleBasics),
AddGenesisAccountCmd(simapp.DefaultNodeHome),
AddGenesisAccountCmd(),
cli.NewCompletionCmd(rootCmd, true),
testnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
Expand Down Expand Up @@ -114,7 +114,7 @@ func queryCommand() *cobra.Command {
)

simapp.ModuleBasics.AddQueryCommands(cmd, initClientCtx)
cmd.PersistentFlags().String(flags.FlagChainID, "", "network chain ID")
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

return cmd
}
Expand All @@ -141,7 +141,7 @@ func txCommand() *cobra.Command {
)

simapp.ModuleBasics.AddTxCommands(cmd, initClientCtx)
cmd.PersistentFlags().String(flags.FlagChainID, "", "network chain ID")
cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID")

return cmd
}
Expand Down

0 comments on commit 2d6d764

Please sign in to comment.