NAT prompt and don't crash for errors

This commit is contained in:
2021-06-26 21:49:54 -06:00
parent e4e152d26c
commit eb43625f34

View File

@@ -10,7 +10,9 @@
(Sys.print ">> ") (Sys.print ">> ")
(let [command (let [command
(.trim (.toString (.readLine (Sys.stdin))))] (.trim (.toString (.readLine (Sys.stdin))))]
(controller.runCommand (dictGet controller.commands command)))))) (if (controller.commands.exists command)
(controller.runCommand (dictGet controller.commands command))
(Sys.print "$command is not a valid command"))))))
(defnew []) (defnew [])
@@ -47,6 +49,7 @@
(case (the Array<Entry> matchingEntries) (case (the Array<Entry> matchingEntries)
([e] (resolve e)) ([e] (resolve e))
([] (throw "name $name doesn't match any entries"))
// TODO disambiguate entries with the same names by listing stringified versions of them and using enterNumber // TODO disambiguate entries with the same names by listing stringified versions of them and using enterNumber
(multipleEntries (throw "ambiguous between multiple entries"))))} (multipleEntries (throw "ambiguous between multiple entries"))))}
0 Math.POSITIVE_INFINITY)) 0 Math.POSITIVE_INFINITY))