Use procedure 'strings.fields' instead of 'string.split' to avoid issues with multiple spaces between arguments.
This commit is contained in:
@@ -53,15 +53,15 @@ log_available_commands :: proc(console: ^Console) {
|
||||
}
|
||||
|
||||
send_input :: proc(console: ^Console, input: string, loc := #caller_location) { // TODO: SS - Decide on a nice name for this. 'run'? 'send_input' is probably alright too.
|
||||
input_strings, err := strings.split(input, " ")
|
||||
input_fields, err := strings.fields(input)
|
||||
if err != .None {
|
||||
log.infof("No input.")
|
||||
return
|
||||
}
|
||||
defer delete(input_strings)
|
||||
defer delete(input_fields)
|
||||
|
||||
command_name := input_strings[0]
|
||||
arguments := input_strings[1:]
|
||||
command_name := input_fields[0]
|
||||
arguments := input_fields[1:]
|
||||
|
||||
// log.infof("Command '%v', arguments: '%v'", command_name, arguments)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user