Reorganize CLI command structure. Fixes #2575

This commit is contained in:
Jack Zampolin
2018-11-07 15:03:00 -08:00
parent 8f690b5b6c
commit d4fb6d4ebe
8 changed files with 193 additions and 111 deletions
+1 -9
View File
@@ -22,15 +22,7 @@ func todoNotImplemented(_ *cobra.Command, _ []string) error {
return errors.New("todo: Command not yet implemented")
}
// AddCommands adds a number of rpc-related subcommands
func AddCommands(cmd *cobra.Command) {
cmd.AddCommand(
initClientCommand(),
statusCommand(),
)
}
func initClientCommand() *cobra.Command {
func InitClientCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "init",
Short: "Initialize light client",
+2 -1
View File
@@ -14,7 +14,8 @@ import (
ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
func statusCommand() *cobra.Command {
// StatusCommand returns the status of the network
func StatusCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "status",
Short: "Query remote node for status",
-9
View File
@@ -2,20 +2,11 @@ package tx
import (
"github.com/gorilla/mux"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
)
// AddCommands adds a number of tx-query related subcommands
func AddCommands(cmd *cobra.Command, cdc *codec.Codec) {
cmd.AddCommand(
SearchTxCmd(cdc),
QueryTxCmd(cdc),
)
}
// register REST routes
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, cliCtx)).Methods("GET")