Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix input with whitespace or no input. issue #106 #122

Closed
wants to merge 7 commits into from
24 changes: 0 additions & 24 deletions .gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions cmd/genji/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func (sh *Shell) execute(in string) {
}

func (sh *Shell) executeInput(in string) error {
in = strings.TrimSpace(in)
switch {
// if it starts with a "." it's a command
// it must not be in the middle of a multi line query though
Expand All @@ -198,6 +199,9 @@ func (sh *Shell) executeInput(in string) error {
err := sh.runQuery(sh.query)
sh.query = ""
return err
// If the input is empty
case in == "":
return nil
// If we reach this case, it means the user is in the middle of a
// multi line query. We change the prompt and set the multiLine var to true.
default:
Expand Down