cosmos-sdk/cmd/basecli/main.go

94 lines
2.7 KiB
Go
Raw Normal View History

2017-04-27 14:17:06 -07:00
package main
import (
"os"
"github.com/spf13/cobra"
2017-05-16 16:14:31 -07:00
2017-04-27 14:17:06 -07:00
keycmd "github.com/tendermint/go-crypto/cmd"
"github.com/tendermint/tmlibs/cli"
2017-07-18 12:57:37 -07:00
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/basecoin/client/commands/auto"
2017-07-18 12:57:37 -07:00
"github.com/tendermint/basecoin/client/commands/proofs"
"github.com/tendermint/basecoin/client/commands/proxy"
rpccmd "github.com/tendermint/basecoin/client/commands/rpc"
"github.com/tendermint/basecoin/client/commands/seeds"
txcmd "github.com/tendermint/basecoin/client/commands/txs"
authcmd "github.com/tendermint/basecoin/modules/auth/commands"
basecmd "github.com/tendermint/basecoin/modules/base/commands"
coincmd "github.com/tendermint/basecoin/modules/coin/commands"
feecmd "github.com/tendermint/basecoin/modules/fee/commands"
2017-07-21 08:15:49 -07:00
ibccmd "github.com/tendermint/basecoin/modules/ibc/commands"
noncecmd "github.com/tendermint/basecoin/modules/nonce/commands"
rolecmd "github.com/tendermint/basecoin/modules/roles/commands"
2017-04-27 14:17:06 -07:00
)
2017-07-05 03:57:52 -07:00
// BaseCli - main basecoin client command
2017-04-27 14:17:06 -07:00
var BaseCli = &cobra.Command{
Use: "basecli",
Short: "Light client for tendermint",
Long: `Basecli is an version of tmcli including custom logic to
present a nice (not raw hex) interface to the basecoin blockchain structure.
This is a useful tool, but also serves to demonstrate how one can configure
tmcli to work for any custom abci app.
`,
}
2017-05-01 00:05:54 -07:00
func main() {
2017-04-27 14:17:06 -07:00
commands.AddBasicFlags(BaseCli)
2017-06-16 01:57:45 -07:00
// Prepare queries
2017-07-05 03:57:52 -07:00
proofs.RootCmd.AddCommand(
// These are default parsers, but optional in your app (you can remove key)
2017-07-19 03:22:01 -07:00
proofs.TxQueryCmd,
proofs.KeyQueryCmd,
coincmd.AccountQueryCmd,
noncecmd.NonceQueryCmd,
rolecmd.RoleQueryCmd,
2017-07-21 08:15:49 -07:00
ibccmd.IBCQueryCmd,
2017-07-05 03:57:52 -07:00
)
proofs.TxPresenters.Register("base", txcmd.BaseTxPresenter{})
2017-06-15 03:27:55 -07:00
// set up the middleware
txcmd.Middleware = txcmd.Wrappers{
feecmd.FeeWrapper{},
rolecmd.RoleWrapper{},
noncecmd.NonceWrapper{},
basecmd.ChainWrapper{},
authcmd.SigWrapper{},
}
txcmd.Middleware.Register(txcmd.RootCmd.PersistentFlags())
// you will always want this for the base send command
txcmd.RootCmd.AddCommand(
2017-07-05 03:57:52 -07:00
// This is the default transaction, optional in your app
coincmd.SendTxCmd,
2017-07-21 14:47:18 -07:00
coincmd.CreditTxCmd,
// this enables creating roles
rolecmd.CreateRoleTxCmd,
// these are for handling ibc
ibccmd.RegisterChainTxCmd,
ibccmd.UpdateChainTxCmd,
2017-07-22 06:09:30 -07:00
ibccmd.PostPacketTxCmd,
2017-07-05 03:57:52 -07:00
)
2017-04-27 14:17:06 -07:00
2017-06-16 01:57:45 -07:00
// Set up the various commands to use
2017-05-01 00:05:54 -07:00
BaseCli.AddCommand(
commands.InitCmd,
2017-06-15 03:27:55 -07:00
commands.ResetCmd,
keycmd.RootCmd,
2017-05-01 00:05:54 -07:00
seeds.RootCmd,
rpccmd.RootCmd,
2017-07-05 03:57:52 -07:00
proofs.RootCmd,
txcmd.RootCmd,
proxy.RootCmd,
commands.VersionCmd,
auto.AutoCompleteCmd,
)
2017-05-01 00:05:54 -07:00
cmd := cli.PrepareMainCmd(BaseCli, "BC", os.ExpandEnv("$HOME/.basecli"))
cmd.Execute()
2017-04-27 14:17:06 -07:00
}