fix: skip history if empty input

This commit is contained in:
2026-03-09 19:26:44 +01:00
parent 901a17b2ca
commit 2489c30b5a

View File

@@ -55,11 +55,18 @@ fn append_history(cmd: String) -> Nil {
fn repl_loop(cmds: dict.Dict(String, fn() -> Nil)) -> a {
let input = get_line("repl> ") |> string.trim
let cmd = string.lowercase(input)
input |> append_history
case dict.get(cmds, cmd) {
Ok(func) -> func()
Error(_) -> io.println(input <> ": unknown command")
case cmd {
"" -> Nil
_ -> {
input |> append_history
case dict.get(cmds, cmd) {
Ok(func) -> func()
Error(_) -> io.println(input <> ": unknown command")
}
}
}
repl_loop(cmds)
}