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/light-client/commands"
|
|
|
|
"github.com/tendermint/light-client/commands/proofs"
|
2017-05-16 11:21:55 -07:00
|
|
|
"github.com/tendermint/light-client/commands/proxy"
|
2017-04-27 14:17:06 -07:00
|
|
|
"github.com/tendermint/light-client/commands/seeds"
|
|
|
|
"github.com/tendermint/light-client/commands/txs"
|
2017-05-12 11:54:50 -07:00
|
|
|
"github.com/tendermint/tmlibs/cli"
|
2017-05-16 16:14:31 -07:00
|
|
|
|
|
|
|
bcmd "github.com/tendermint/basecoin/cmd/basecli/commands"
|
2017-04-27 14:17:06 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
// BaseCli represents the base command when called without any subcommands
|
|
|
|
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-06-15 03:27:55 -07:00
|
|
|
pr := proofs.RootCmd
|
2017-06-16 05:00:43 -07:00
|
|
|
// These are default parsers, but optional in your app (you can remove key)
|
2017-06-15 03:27:55 -07:00
|
|
|
pr.AddCommand(proofs.TxCmd)
|
|
|
|
pr.AddCommand(proofs.KeyCmd)
|
|
|
|
pr.AddCommand(bcmd.AccountQueryCmd)
|
|
|
|
|
2017-06-16 05:00:43 -07:00
|
|
|
// you will always want this for the base send command
|
2017-06-15 04:11:09 -07:00
|
|
|
proofs.TxPresenters.Register("base", bcmd.BaseTxPresenter{})
|
2017-06-15 03:27:55 -07:00
|
|
|
tr := txs.RootCmd
|
2017-06-15 04:11:09 -07:00
|
|
|
tr.AddCommand(bcmd.SendTxCmd)
|
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,
|
2017-06-15 03:27:55 -07:00
|
|
|
pr,
|
|
|
|
tr,
|
|
|
|
proxy.RootCmd)
|
2017-05-01 00:05:54 -07:00
|
|
|
|
2017-05-12 11:54:50 -07:00
|
|
|
cmd := cli.PrepareMainCmd(BaseCli, "BC", os.ExpandEnv("$HOME/.basecli"))
|
|
|
|
cmd.Execute()
|
2017-04-27 14:17:06 -07:00
|
|
|
}
|