From 6f429c4d43f1f0a66830573c8082e7ea68e4561e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 2 Aug 2021 20:28:52 -0600 Subject: [PATCH] [nat] rename archiveController commands to capital names --- .../src/nat/ArchiveController.kiss | 33 ++++++++++--------- .../nat-archive-tool/src/test/TestMain.hx | 2 ++ .../nat-archive-tool/src/test/TestMain.kiss | 11 +++++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 0108cda1..0216abbe 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -134,34 +134,35 @@ &mut :ChangeSet lastChangeSet [] :Map commands (new Map)] - (defCommand selectEntry [e OneEntry] + (defCommand SelectEntry [e OneEntry] (set selectedEntries [e]) []) - (defCommand selectEntries [entries (Entries null null)] + (defCommand SelectEntries [entries (Entries null null)] (set selectedEntries entries) []) - (defCommand selectAllEntries [] + (defCommand SelectAllEntries [] (set selectedEntries (for =>id e archive.entries e)) []) - (defCommand selectLastChangeSet [] + (defCommand SelectLastChangeSet [] (set selectedEntries lastChangeSet) []) - (defCommand printSelectedEntries [entries (SelectedEntries null null)] + (defCommand PrintSelectedEntries [entries (SelectedEntries null null)] (doFor e entries (ui.displayMessage (archive.fullString e))) []) - (defCommand printComponent [entries (SelectedEntries null null) + (defCommand PrintComponent [entries (SelectedEntries null null) componentType (Text null)] (doFor e entries (ui.displayMessage (archive.componentData e componentType))) []) - (defCommand createEntry [name (Text null)] + (defCommand CreateEntry [name (Text null)] [(archive.createEntry ->e (addComponent archive e Name name))]) - (defCommand createEntries [names (VarText null)] + (defCommand CreateEntries [names (VarText null)] + // createEntry returns a list, so these lists must be flattened (flatten (for name names - (createEntry name)))) + (CreateEntry name)))) - (defCommand addTags [entries (SelectedEntries 1 null) + (defCommand AddTags [entries (SelectedEntries 1 null) tagsToAdd (VarText null)] (doFor e entries (withWritableEntry archive e @@ -171,7 +172,7 @@ (addComponent archive e Tags (for tag tagsToAdd =>tag 1))))) entries) // TODO this includes entries that already had the tag in the changeset - (defCommand removeTags [entries (SelectedEntries 1 null) + (defCommand RemoveTags [entries (SelectedEntries 1 null) tagsToRemove (VarText null)] (doFor e entries (withWritableEntry archive e @@ -180,13 +181,13 @@ (doFor tag tagsToRemove (tags.remove tag)))))) entries) // TODO this includes entries that didn't have the tag in the changeset - (defCommand selectByTags [tagsBoolExp (Text null)] - (selectEntries (filter archive.entries ->e (tagsMatch archive e tagsBoolExp)))) + (defCommand SelectByTags [tagsBoolExp (Text null)] + (SelectEntries (filter archive.entries ->e (tagsMatch archive e tagsBoolExp)))) - (defCommand selectByComponents [componentsBoolExp (Text null)] - (selectEntries (filter archive.entries ->e (componentsMatch e componentsBoolExp)))) + (defCommand SelectByComponents [componentsBoolExp (Text null)] + (SelectEntries (filter archive.entries ->e (componentsMatch e componentsBoolExp)))) - (defCommand attachFiles [entries (SelectedEntries 1 null) + (defCommand AttachFiles [entries (SelectedEntries 1 null) // TODO add File and Files as an argument type for commands, ArchiveUI // TODO make tkinter file browser externs and use tkinter as the file picking mechanism for CLI files (VarText null)] diff --git a/projects/nat-archive-tool/src/test/TestMain.hx b/projects/nat-archive-tool/src/test/TestMain.hx index 1f5fee23..e958a0e7 100644 --- a/projects/nat-archive-tool/src/test/TestMain.hx +++ b/projects/nat-archive-tool/src/test/TestMain.hx @@ -4,9 +4,11 @@ import kiss.Kiss; import kiss.Prelude; import nat.BoolExpInterp; import nat.Archive; +import nat.ArchiveController; import nat.Lib; import nat.components.*; import nat.systems.*; +import uuid.Uuid; @:build(kiss.Kiss.build()) class TestMain {} diff --git a/projects/nat-archive-tool/src/test/TestMain.kiss b/projects/nat-archive-tool/src/test/TestMain.kiss index 01befb08..9853f4ca 100644 --- a/projects/nat-archive-tool/src/test/TestMain.kiss +++ b/projects/nat-archive-tool/src/test/TestMain.kiss @@ -28,7 +28,12 @@ [author Author name Name] (assert (= author "Rafael Krux")) - (assert (= name "Adventure")))) + (assert (= name "Adventure"))) -(let [wikipedia (new MediaWikiSystem "https://en.wikipedia.org/w/api.php" null null 1)] - ~(wikipedia.queryImageUrls (wikipedia.queryImageTitles ["Phoenix Wright"]))) \ No newline at end of file + (let [wikipedia (new MediaWikiSystem "https://en.wikipedia.org/w/api.php" null null 1)] + ~(wikipedia.queryImageUrls (wikipedia.queryImageTitles ["Phoenix Wright"]))) + + // TODO make a dummy UI for this, instead of passing null + (let [controller (new ArchiveController archive null)] + // TODO test controller + 0))