-
Notifications
You must be signed in to change notification settings - Fork 167
improve commandline processing #1091
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
base: master
Are you sure you want to change the base?
Conversation
|
✂️ |
# Conflicts: # server/player/player.go
|
I think I've achieved everything I need from this PR 🔥 |
| // string ... | ||
| func (p parser) string(line *Line, v reflect.Value) error { | ||
| if p.fields == 1 { | ||
| return p.restAsString(line, v) |
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.
Isn't this what the Varargs parameter type is for?
| val := v[0] | ||
| if val == "" { | ||
| line.RemoveNext() | ||
| return line.Next() | ||
| } | ||
| return val, true |
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.
Ignoring the empty arg should probably be done in NextN for more consistent behavior? It's a bit odd that one would skip over empty args and the other wouldn't
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.
Would go a step further and do the same for RemoveN
| args := strings.Split(commandLine, " ") | ||
|
|
||
| var ( | ||
| name string |
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.
Would be good to leave a comment here explaining this is to allow something like / command to work
with this change you can put as much spaces as you want into the command
something like this:
/tell "Cool guy" hello!will not result an error any more