func cmdConsole(app *cli.App, c *cli.Context) error { // don't hard exit on mistyped commands (eg. check vs check_tx) app.CommandNotFound = badCmd for { fmt.Printf("\n> ") bufReader := bufio.NewReader(os.Stdin) line, more, err := bufReader.ReadLine() if more { return errors.New("Input is too long") } else if err != nil { return err } args := []string{"tmsp-cli"} args = append(args, strings.Split(string(line), " ")...) if err := app.Run(args); err != nil { // if the command doesn't succeed, inform the user without exiting fmt.Println("Error:", err.Error()) } } }