feat: normalize input to lowercase
This commit is contained in:
@@ -53,11 +53,12 @@ fn append_history(cmd: String) -> Nil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn repl_loop(cmds: dict.Dict(String, fn() -> Nil)) -> a {
|
fn repl_loop(cmds: dict.Dict(String, fn() -> Nil)) -> a {
|
||||||
let cmd = get_line("repl> ") |> string.trim
|
let input = get_line("repl> ") |> string.trim
|
||||||
cmd |> append_history
|
let cmd = string.lowercase(input)
|
||||||
|
input |> append_history
|
||||||
case dict.get(cmds, cmd) {
|
case dict.get(cmds, cmd) {
|
||||||
Ok(func) -> func()
|
Ok(func) -> func()
|
||||||
Error(_) -> io.println(cmd <> ": unknown command")
|
Error(_) -> io.println(input <> ": unknown command")
|
||||||
}
|
}
|
||||||
repl_loop(cmds)
|
repl_loop(cmds)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user