Browse Source

cleanup

pull/1780/head
Zach Ramsay 7 years ago
parent
commit
3330cb4856
1 changed files with 15 additions and 15 deletions
  1. +15
    -15
      cmd/abci-cli/abci-cli.go

+ 15
- 15
cmd/abci-cli/abci-cli.go View File

@ -102,9 +102,9 @@ func Execute() {
} }
func addGlobalFlags() { func addGlobalFlags() {
RootCmd.PersistentFlags().StringVarP(&address, "address", "", "tcp://127.0.0.1:46658", "address of application socket")
RootCmd.PersistentFlags().StringVarP(&abci, "abci", "", "socket", "socket or grpc")
RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "print the command and results as if it were a console session")
RootCmd.PersistentFlags().StringVarP(&address, "address", "", "tcp://127.0.0.1:46658", "Address of application socket")
RootCmd.PersistentFlags().StringVarP(&abci, "abci", "", "socket", "Either socket or grpc")
RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Print the command and results as if it were a console session")
} }
func addQueryFlags() { func addQueryFlags() {
@ -158,8 +158,8 @@ var consoleCmd = &cobra.Command{
var echoCmd = &cobra.Command{ var echoCmd = &cobra.Command{
Use: "echo", Use: "echo",
Short: "",
Long: "Have the application echo a message",
Short: "Have the application echo a message",
Long: "",
Run: cmdEcho, Run: cmdEcho,
} }
var infoCmd = &cobra.Command{ var infoCmd = &cobra.Command{
@ -170,21 +170,21 @@ var infoCmd = &cobra.Command{
} }
var setOptionCmd = &cobra.Command{ var setOptionCmd = &cobra.Command{
Use: "set_option", Use: "set_option",
Short: "Set an options on the application",
Short: "Set an option on the application",
Long: "", Long: "",
Run: cmdSetOption, Run: cmdSetOption,
} }
var deliverTxCmd = &cobra.Command{ var deliverTxCmd = &cobra.Command{
Use: "deliver_tx", Use: "deliver_tx",
Short: "Deliver a new tx to the application",
Short: "Deliver a new transaction to the application",
Long: "", Long: "",
Run: cmdDeliverTx, Run: cmdDeliverTx,
} }
var checkTxCmd = &cobra.Command{ var checkTxCmd = &cobra.Command{
Use: "check_tx", Use: "check_tx",
Short: "Validate a tx",
Short: "Validate a transaction",
Long: "", Long: "",
Run: cmdCheckTx, Run: cmdCheckTx,
} }
@ -250,7 +250,7 @@ func cmdBatch(cmd *cobra.Command, args []string) {
pArgs := persistentArgs(line) pArgs := persistentArgs(line)
out, err := exec.Command(pArgs[0], pArgs[1:]...).Output() out, err := exec.Command(pArgs[0], pArgs[1:]...).Output()
if err != nil { if err != nil {
panic(err)
ifExit(err)
} }
fmt.Println(string(out)) fmt.Println(string(out))
} }
@ -271,7 +271,7 @@ func cmdConsole(cmd *cobra.Command, args []string) {
pArgs := persistentArgs(line) pArgs := persistentArgs(line)
out, err := exec.Command(pArgs[0], pArgs[1:]...).Output() out, err := exec.Command(pArgs[0], pArgs[1:]...).Output()
if err != nil { if err != nil {
panic(err)
ifExit(err)
} }
fmt.Println(string(out)) fmt.Println(string(out))
} }
@ -280,7 +280,7 @@ func cmdConsole(cmd *cobra.Command, args []string) {
// Have the application echo a message // Have the application echo a message
func cmdEcho(cmd *cobra.Command, args []string) { func cmdEcho(cmd *cobra.Command, args []string) {
if len(args) != 1 { if len(args) != 1 {
ifExit(errors.New("Command echo takes 1 argument"))
ifExit(errors.New("Command echo takes only 1 argument"))
} }
resEcho := client.EchoSync(args[0]) resEcho := client.EchoSync(args[0])
printResponse(cmd, args, response{ printResponse(cmd, args, response{
@ -306,7 +306,7 @@ func cmdInfo(cmd *cobra.Command, args []string) {
// Set an option on the application // Set an option on the application
func cmdSetOption(cmd *cobra.Command, args []string) { func cmdSetOption(cmd *cobra.Command, args []string) {
if len(args) != 2 { if len(args) != 2 {
ifExit(errors.New("Command set_option takes 2 arguments (key, value)"))
ifExit(errors.New("Command set_option takes exactly 2 arguments (key, value)"))
} }
resSetOption := client.SetOptionSync(args[0], args[1]) resSetOption := client.SetOptionSync(args[0], args[1])
printResponse(cmd, args, response{ printResponse(cmd, args, response{
@ -317,7 +317,7 @@ func cmdSetOption(cmd *cobra.Command, args []string) {
// Append a new tx to application // Append a new tx to application
func cmdDeliverTx(cmd *cobra.Command, args []string) { func cmdDeliverTx(cmd *cobra.Command, args []string) {
if len(args) != 1 { if len(args) != 1 {
ifExit(errors.New("Command deliver_tx takes 1 argument"))
ifExit(errors.New("Command deliver_tx takes only 1 argument"))
} }
txBytes, err := stringOrHexToBytes(args[0]) txBytes, err := stringOrHexToBytes(args[0])
if err != nil { if err != nil {
@ -334,7 +334,7 @@ func cmdDeliverTx(cmd *cobra.Command, args []string) {
// Validate a tx // Validate a tx
func cmdCheckTx(cmd *cobra.Command, args []string) { func cmdCheckTx(cmd *cobra.Command, args []string) {
if len(args) != 1 { if len(args) != 1 {
ifExit(errors.New("Command check_tx takes 1 argument"))
ifExit(errors.New("Command check_tx takes only 1 argument"))
} }
txBytes, err := stringOrHexToBytes(args[0]) txBytes, err := stringOrHexToBytes(args[0])
if err != nil { if err != nil {
@ -361,7 +361,7 @@ func cmdCommit(cmd *cobra.Command, args []string) {
// Query application state // Query application state
func cmdQuery(cmd *cobra.Command, args []string) { func cmdQuery(cmd *cobra.Command, args []string) {
if len(args) != 1 { if len(args) != 1 {
ifExit(errors.New("Command query takes 1 argument, the query bytes"))
ifExit(errors.New("Command query takes only 1 argument, the query bytes"))
} }
queryBytes, err := stringOrHexToBytes(args[0]) queryBytes, err := stringOrHexToBytes(args[0])


Loading…
Cancel
Save