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
(let [e (_newEntry)]
(initializer e)
(dictSet entries e.id e)
(refreshEntry e)
e))

View File

@@ -57,7 +57,7 @@
archive
continuation))
((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
(unless max (set max (count archive.entries)))
(ui.chooseEntries
@@ -69,7 +69,7 @@
(< max entries.length))
(ui.reportError "The requested command expects between $min and $max entries. You chose: $entries.length")
(continuation selectedEntries)))
(continuation entries)))
min
max))))
@@ -116,17 +116,17 @@
:Map<String,Command> commands (new Map)]
(defcommand selectEntry [e OneEntry]
(set selectedEntries [e]))
(set selectedEntries [e]) [])
(defcommand selectEntries [entries (Entries null null)]
(set selectedEntries entries))
(set selectedEntries entries) [])
(defcommand selectLastChangeSet []
(set selectedEntries lastChangeSet))
(set selectedEntries lastChangeSet) [])
(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)]
(archive.createEntry ->e
(addComponent archive e Name name))))
[(archive.createEntry ->e
(addComponent archive e Name name))]))

View File

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

View File

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