From f3d4ea84115ff519009e1d2157ee1abf2399661f Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 29 Jun 2021 14:23:36 -0600 Subject: [PATCH] [nat] removeTags, selectByTags --- .../src/nat/ArchiveController.kiss | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index f6ea41d7..951e6fda 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -169,4 +169,16 @@ (withWritableComponents archive e [tags Tags] (doFor tag tagsToAdd (dictSet tags tag 1))) (addComponent archive e Tags (for tag tagsToAdd =>tag 1))))) - entries)) \ No newline at end of file + entries) // TODO this includes entries that already had the tag in the changeset + + (defcommand removeTags [entries (SelectedEntries 1 null) + tagsToRemove (VarText null)] + (doFor e entries + (withWritableEntry archive e + (when (hasComponent e Tags) + (withWritableComponents archive e [tags Tags] + (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))))) \ No newline at end of file