Skip to content

Commit

Permalink
Merge PR cosmos#6595: Single Binary & Command Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Jul 7, 2020
1 parent 307fba3 commit a9f7dae
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 267 deletions.
3 changes: 0 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ import (
const appName = "SimApp"

var (
// DefaultCLIHome default home directories for the application CLI
DefaultCLIHome = os.ExpandEnv("$HOME/.simapp")

// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome = os.ExpandEnv("$HOME/.simapp")

Expand Down
136 changes: 0 additions & 136 deletions cmd/simcli/main.go

This file was deleted.

118 changes: 0 additions & 118 deletions cmd/simd/main.go

This file was deleted.

15 changes: 11 additions & 4 deletions cmd/simd/genaccounts.go → simd/cmd/genaccounts.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmd

import (
"bufio"
Expand All @@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
Expand All @@ -28,7 +29,7 @@ const (
)

// AddGenesisAccountCmd returns add-genesis-account cobra Command.
func AddGenesisAccountCmd(ctx *server.Context, depCdc codec.JSONMarshaler, cdc codec.Marshaler, defaultClientHome string) *cobra.Command {
func AddGenesisAccountCmd(defaultClientHome string) *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 @@ -39,7 +40,13 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
`,
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
config := ctx.Config
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.Codec
cdc := clientCtx.JSONMarshaler.(codec.Marshaler)

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config

homeDir, _ := cmd.Flags().GetString(cli.HomeFlag)
config.SetRoot(homeDir)

Expand Down Expand Up @@ -160,5 +167,5 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
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")

return cmd
return flags.GetCommands(cmd)[0]
}
Loading

0 comments on commit a9f7dae

Please sign in to comment.