Collapsed nested commands in gaiacli

This commit is contained in:
Ethan Frey 2018-02-07 17:38:06 +01:00 committed by Ethan Buchman
parent b10afcaf4c
commit c7f31bdf26
4 changed files with 10 additions and 17 deletions

View File

@ -13,7 +13,7 @@ ci: get_tools get_vendor_deps build test_cover
# This can be unified later, here for easy demos
gaia:
go build $(BUILD_FLAGS) -o build/gaid ./examples/gaiad
go build $(BUILD_FLAGS) -o build/gaiad ./examples/gaiad
go build $(BUILD_FLAGS) -o build/gaiacli ./examples/gaiacli
build:

View File

@ -53,14 +53,10 @@ func init() {
postCmd.PersistentFlags().String(flagPassword, "", "Password to use the named private key")
}
// ClientCommands returns a sub-tree of all basic client commands
// AddClientCommands returns a sub-tree of all basic client commands
//
// Call AddGetCommand and AddPostCommand to add custom txs and queries
func ClientCommands() *cobra.Command {
cmd := &cobra.Command{
Use: "client",
Short: "Interact with the chain via a light-client",
}
func AddClientCommands(cmd *cobra.Command) {
cmd.AddCommand(
initClientCommand(),
statusCmd,
@ -75,7 +71,6 @@ func ClientCommands() *cobra.Command {
lineBreak,
serveCommand(),
)
return cmd
}
// AddGetCommand adds one or more query subcommands

View File

@ -15,11 +15,11 @@ const (
flagFee = "fee"
)
// chubCmd is the entry point for this binary
// gaiacliCmd is the entry point for this binary
var (
chubCmd = &cobra.Command{
Use: "chub",
Short: "Cosmos Hub command-line tool",
gaiacliCmd = &cobra.Command{
Use: "gaiacli",
Short: "Gaia light-client",
}
lineBreak = &cobra.Command{Run: func(*cobra.Command, []string) {}}
@ -55,16 +55,15 @@ func main() {
AddGetCommand(getAccountCmd)
AddPostCommand(postSendCommand())
chubCmd.AddCommand(
AddClientCommands(gaiacliCmd)
gaiacliCmd.AddCommand(
KeyCommands(),
ClientCommands(),
lineBreak,
VersionCmd,
)
// prepare and add flags
// executor := cli.PrepareMainCmd(chubCmd, "CH", os.ExpandEnv("$HOME/.cosmos-chub"))
executor := cli.PrepareBaseCmd(chubCmd, "CH", os.ExpandEnv("$HOME/.cosmos-chub"))
executor := cli.PrepareBaseCmd(gaiacliCmd, "GA", os.ExpandEnv("$HOME/.cosmos-chub"))
executor.Execute()
}

View File

@ -29,7 +29,6 @@ import:
subpackages:
- ripemd160
- package: github.com/spf13/cobra
version: ~0.0.1
- package: github.com/spf13/viper
version: ^1.0.0
testImport: