nat fix bugs

This commit is contained in:
2021-06-27 18:59:59 -06:00
parent 68ff8008ad
commit 49bbbe6599
4 changed files with 12 additions and 10 deletions

View File

@@ -20,6 +20,7 @@
(defmethod :Entry createEntry [:Entry->Dynamic initializer] // initializer returns Dynamic so ->:Void isn't required (defmethod :Entry createEntry [:Entry->Dynamic initializer] // initializer returns Dynamic so ->:Void isn't required
(let [e (_newEntry)] (let [e (_newEntry)]
(initializer e) (initializer e)
(dictSet entries e.id e)
(refreshEntry e) (refreshEntry e)
e)) e))

View File

@@ -57,7 +57,7 @@
archive archive
continuation)) continuation))
((Entries min max) ((Entries min max)
(unless min (set min 0)) (unless min (set min 1))
// TODO might want to optimize this O(n) count operation by pre-calculating it // TODO might want to optimize this O(n) count operation by pre-calculating it
(unless max (set max (count archive.entries))) (unless max (set max (count archive.entries)))
(ui.chooseEntries (ui.chooseEntries
@@ -69,7 +69,7 @@
(< max entries.length)) (< max entries.length))
(ui.reportError "The requested command expects between $min and $max entries. You chose: $entries.length") (ui.reportError "The requested command expects between $min and $max entries. You chose: $entries.length")
(continuation selectedEntries))) (continuation entries)))
min min
max)))) max))))
@@ -116,17 +116,17 @@
:Map<String,Command> commands (new Map)] :Map<String,Command> commands (new Map)]
(defcommand selectEntry [e OneEntry] (defcommand selectEntry [e OneEntry]
(set selectedEntries [e])) (set selectedEntries [e]) [])
(defcommand selectEntries [entries (Entries null null)] (defcommand selectEntries [entries (Entries null null)]
(set selectedEntries entries)) (set selectedEntries entries) [])
(defcommand selectLastChangeSet [] (defcommand selectLastChangeSet []
(set selectedEntries lastChangeSet)) (set selectedEntries lastChangeSet) [])
(defcommand printSelectedEntries [entries (SelectedEntries null null)] (defcommand printSelectedEntries [entries (SelectedEntries null null)]
(doFor e entries (ui.displayMessage (archive.fullString e)))) (doFor e entries (ui.displayMessage (archive.fullString e))) [])
(defcommand createEntry [name (Text null null)] (defcommand createEntry [name (Text null null)]
(archive.createEntry ->e [(archive.createEntry ->e
(addComponent archive e Name name)))) (addComponent archive e Name name))]))

View File

@@ -4,7 +4,8 @@ import kiss.Prelude;
import kiss.List; import kiss.List;
import kiss.Operand; import kiss.Operand;
import sys.FileSystem; import sys.FileSystem;
import nat.ArchiveController.CommandArgType; import nat.ArchiveController;
using StringTools; using StringTools;
@:build(kiss.Kiss.build()) @:build(kiss.Kiss.build())

View File

@@ -12,7 +12,7 @@
(.trim (.toString (.readLine (Sys.stdin))))] (.trim (.toString (.readLine (Sys.stdin))))]
(if (controller.commands.exists command) (if (controller.commands.exists command)
(controller.runCommand (dictGet controller.commands command)) (controller.runCommand (dictGet controller.commands command))
(Sys.print "$command is not a valid command")))))) (Sys.println "$command is not a valid command"))))))
(defnew []) (defnew [])