-
Notifications
You must be signed in to change notification settings - Fork 84
Conversation
zramsay
commented
Oct 18, 2017
•
edited
edited
- closes consolidate binaries #95, use spf13/cobra instead of urfave/cli #101
0cdf4ef
to
8939b9f
Compare
8939b9f
to
ec5507b
Compare
cmd/abci-cli/abci-cli.go
Outdated
Use: "console", | ||
Short: "Start an interactive abci console for multiple commands", | ||
Long: "", | ||
ValidArgs: []string{"batch", "echo", "info", "set_option", "deliver_tx", "check_tx", "commit", "query"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ec5507b
to
3330cb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great other than the exit strategy. We should only use RunE
and always return an error.
cmd/abci-cli/abci-cli.go
Outdated
bufReader := bufio.NewReader(os.Stdin) | ||
for { | ||
line, more, err := bufReader.ReadLine() | ||
if more { | ||
return errors.New("Input line is too long") | ||
ifExit(errors.New("Input line is too long")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should only use RunE
and return errors here.
args := persistentArgs(line) | ||
app.Run(args) //cli prints error within its func call | ||
pArgs := persistentArgs(line) | ||
out, err := exec.Command(pArgs[0], pArgs[1:]...).Output() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shelling it out? would be better if we could keep in process
cmd/abci-cli/abci-cli.go
Outdated
if len(args) != 1 { | ||
return errors.New("Command check_tx takes 1 argument") | ||
ifExit(errors.New("Command check_tx takes only 1 argument")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for "only"
cmd/abci-cli/abci-cli.go
Outdated
srv, err := server.NewServer(addrC, abci, app) | ||
if err != nil { | ||
logger.Error(err.Error()) | ||
os.Exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return err
cmd/abci-cli/abci-cli.go
Outdated
@@ -426,3 +499,10 @@ func stringOrHexToBytes(s string) ([]byte, error) { | |||
|
|||
return []byte(s[1 : len(s)-1]), nil | |||
} | |||
|
|||
func ifExit(err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this and all use of os.Exit
in functions
807a4f3
to
f013ee5
Compare
Use the single client connection at startup time for sending over commands instead of shelling out for every command. This code fixes the regression from #117 which instead used "os/exec".Command with: "abci-cli <the_command> [args...]" The purpose of this code is to restore us back to the state after cobra replace urlfave/cli. There is still a bit of work to implement Batch itself, but that should be simpler as a focused command. Fixes #133
Use the single client connection at startup time for sending over commands instead of shelling out for every command. This code fixes the regression from #117 which instead used "os/exec".Command with: "abci-cli <the_command> [args...]" The purpose of this code is to restore us back to the state after cobra replace urlfave/cli. There is still a bit of work to implement Batch itself, but that should be simpler as a focused command. Fixes #133