3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-14 07:59:31 +01:00

parse lines more robustly

This commit is contained in:
Jeremy Latt 2014-02-16 22:22:46 -08:00
parent 4e56ea1bdc
commit a894e3f37f

View File

@ -107,7 +107,9 @@ func parseLine(line string) (command string, args []string) {
for arg, rest := parseArg(line); arg != ""; arg, rest = parseArg(rest) { for arg, rest := parseArg(line); arg != ""; arg, rest = parseArg(rest) {
args = append(args, arg) args = append(args, arg)
} }
if len(args) > 0 {
command, args = strings.ToUpper(args[0]), args[1:] command, args = strings.ToUpper(args[0]), args[1:]
}
return return
} }