2018-02-22 06:33:34 -08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"github.com/tendermint/tmlibs/cli"
|
|
|
|
|
2018-02-22 08:20:25 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/client/keys"
|
2018-02-22 06:33:34 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/version"
|
|
|
|
)
|
|
|
|
|
|
|
|
// gaiacliCmd is the entry point for this binary
|
|
|
|
var (
|
|
|
|
basecliCmd = &cobra.Command{
|
|
|
|
Use: "basecli",
|
|
|
|
Short: "Basecoin light-client",
|
|
|
|
}
|
|
|
|
|
|
|
|
lineBreak = &cobra.Command{Run: func(*cobra.Command, []string) {}}
|
|
|
|
)
|
|
|
|
|
|
|
|
func todoNotImplemented(_ *cobra.Command, _ []string) error {
|
|
|
|
return errors.New("TODO: Command not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// disable sorting
|
|
|
|
cobra.EnableCommandSorting = false
|
|
|
|
|
|
|
|
// generic client commands
|
|
|
|
AddClientCommands(basecliCmd)
|
2018-02-22 09:15:01 -08:00
|
|
|
|
|
|
|
// query/post commands (custom to binary)
|
2018-02-22 06:33:34 -08:00
|
|
|
basecliCmd.AddCommand(
|
2018-02-22 09:15:01 -08:00
|
|
|
GetCommands(getAccountCmd())...)
|
2018-02-22 06:33:34 -08:00
|
|
|
basecliCmd.AddCommand(
|
|
|
|
PostCommands(postSendCommand())...)
|
|
|
|
|
|
|
|
// add proxy, version and key info
|
|
|
|
basecliCmd.AddCommand(
|
|
|
|
lineBreak,
|
|
|
|
serveCommand(),
|
2018-02-22 08:20:25 -08:00
|
|
|
keys.Commands(),
|
2018-02-22 06:33:34 -08:00
|
|
|
lineBreak,
|
|
|
|
version.VersionCmd,
|
|
|
|
)
|
|
|
|
|
|
|
|
// prepare and add flags
|
2018-02-22 08:20:25 -08:00
|
|
|
executor := cli.PrepareMainCmd(basecliCmd, "BC", os.ExpandEnv("$HOME/.basecli"))
|
2018-02-22 06:33:34 -08:00
|
|
|
executor.Execute()
|
|
|
|
}
|