-
Notifications
You must be signed in to change notification settings - Fork 94
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
ignore whitespace. press enter with no input or input ended by whitespace #115
Conversation
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.
Thank you @tzzed!
I have proposed a simpler alternative in the comments
.gitignore
Outdated
@@ -22,3 +22,6 @@ profile.* | |||
|
|||
# Databases | |||
*.db | |||
*.idea |
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 should not be added to this PR by rather to your global .gitignore. Read this to see how to do it https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/
cmd/genji/shell/shell.go
Outdated
//If we press enter without any query | ||
case len(in) == 0: | ||
return sh.QueryError(in) | ||
// If it ends by espace "; " |
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 check is not necessary if we trim in
cmd/genji/shell/shell.go
Outdated
@@ -184,6 +184,16 @@ func (sh *Shell) execute(in string) { | |||
} | |||
} | |||
|
|||
// Query Error return an error if we press return with no input, or ended by whitespace | |||
func (sh *Shell) QueryError(in string) 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.
The name of this function doesn't seem to have anything to do with the content of the function, does it?
implementation of @asdine's suggestion for a simpler version. |
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.
Looks good to me 👍
@tzzed Could you remove the .gitignore lines and rebase your PR please?
this a fix of #106
and
both are fixed.