Skip to content

Commit

Permalink
Merge PR CosmWasm#37: Revert removal of auth/bank commands from root
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Jun 6, 2019
1 parent 0846cc5 commit 22e46c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .pending/breaking/gaiacli/Bank-and-Auth-module

This file was deleted.

8 changes: 4 additions & 4 deletions cli_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,21 +309,21 @@ func (f *Fixtures) CLIConfig(key, value string, flags ...string) {

// TxSend is gaiacli tx send
func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx bank send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags())
cmd := fmt.Sprintf("%s tx send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags())
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass)
}

func (f *Fixtures) txSendWithConfirm(
from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string,
) (bool, string, string) {

cmd := fmt.Sprintf("%s tx bank send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags())
cmd := fmt.Sprintf("%s tx send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags())
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, client.DefaultKeyPass)
}

// TxSign is gaiacli tx sign
func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx auth sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName)
cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass)
}

Expand All @@ -343,7 +343,7 @@ func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, str
func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string,
flags ...string) (bool, string, string) {

cmd := fmt.Sprintf("%s tx auth multisign %v %s %s %s", f.GaiacliBinary, f.Flags(),
cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.GaiacliBinary, f.Flags(),
fileName, name, strings.Join(signaturesFiles, " "),
)
return executeWriteRetStdStreams(f.T, cmd)
Expand Down
24 changes: 22 additions & 2 deletions cmd/gaiacli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ import (
"os"
"path"

"github.com/cosmos/gaia/app"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
"github.com/cosmos/cosmos-sdk/x/bank"
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"

"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/gaia/app"
)

func main() {
Expand Down Expand Up @@ -106,6 +110,11 @@ func txCmd(cdc *amino.Codec) *cobra.Command {
}

txCmd.AddCommand(
bankcmd.SendTxCmd(cdc),
client.LineBreak,
authcmd.GetSignCommand(cdc),
authcmd.GetMultiSignCommand(cdc),
client.LineBreak,
tx.GetBroadcastCommand(cdc),
tx.GetEncodeCommand(cdc),
client.LineBreak,
Expand All @@ -114,6 +123,17 @@ func txCmd(cdc *amino.Codec) *cobra.Command {
// add modules' tx commands
app.ModuleBasics.AddTxCommands(txCmd, cdc)

// remove auth and bank commands as they're mounted under the root tx command
var cmdsToRemove []*cobra.Command

for _, cmd := range txCmd.Commands() {
if cmd.Use == auth.ModuleName || cmd.Use == bank.ModuleName {
cmdsToRemove = append(cmdsToRemove, cmd)
}
}

txCmd.RemoveCommand(cmdsToRemove...)

return txCmd
}

Expand Down

0 comments on commit 22e46c5

Please sign in to comment.