From eb43625f344457b0f41518de7acd9eb7b502b13b Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sat, 26 Jun 2021 21:49:54 -0600 Subject: [PATCH] NAT prompt and don't crash for errors --- projects/nat-archive-tool/src/nat/CLI.kiss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/nat-archive-tool/src/nat/CLI.kiss b/projects/nat-archive-tool/src/nat/CLI.kiss index 94a55df6..800883c2 100644 --- a/projects/nat-archive-tool/src/nat/CLI.kiss +++ b/projects/nat-archive-tool/src/nat/CLI.kiss @@ -10,7 +10,9 @@ (Sys.print ">> ") (let [command (.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 []) @@ -47,6 +49,7 @@ (case (the Array matchingEntries) ([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 (multipleEntries (throw "ambiguous between multiple entries"))))} 0 Math.POSITIVE_INFINITY))