Browse Source

console: fix output, closes #93

pull/1780/head
Zach Ramsay 7 years ago
parent
commit
36de70be10
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      cmd/abci-cli/abci-cli.go

+ 10
- 6
cmd/abci-cli/abci-cli.go View File

@ -259,7 +259,7 @@ func cmdBatch(cmd *cobra.Command, args []string) {
func cmdConsole(cmd *cobra.Command, args []string) {
for {
fmt.Printf("\n> ")
fmt.Printf("> ")
bufReader := bufio.NewReader(os.Stdin)
line, more, err := bufReader.ReadLine()
if more {
@ -454,12 +454,16 @@ func printResponse(cmd *cobra.Command, args []string, rsp response) {
fmt.Println(">", cmd.Use, strings.Join(args, " "))
}
if !rsp.Code.IsOK() {
fmt.Printf("-> code: %s\n", rsp.Code.String())
}
// Always print the status code.
fmt.Printf("-> code: %s\n", rsp.Code.String())
if len(rsp.Data) != 0 {
fmt.Printf("-> data: %s\n", rsp.Data)
fmt.Printf("-> data.hex: %X\n", rsp.Data)
// Do no print this line when using the commit command
// because the string comes out as gibberish
if cmd.Use != "commit" {
fmt.Printf("-> data: %s\n", rsp.Data)
}
fmt.Printf("-> data.hex: 0x%X\n", rsp.Data)
}
if rsp.Log != "" {
fmt.Printf("-> log: %s\n", rsp.Log)


Loading…
Cancel
Save