commit 8ce2cb23673fcf025bb2b75b9273124a676e4049
parent 87eecfad1b411457a6e1252a20fdac6f94ebfec4
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date: Sat, 3 Feb 2024 19:52:13 +0000
`retag` command
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/iens.scm b/src/iens.scm
@@ -580,6 +580,18 @@
(loop (cdr todo)))))))
(print-tags entry-id))
+(define (retag* mtime entry-id tag-list)
+ (trace `(retag ,mtime ,entry-id . ,tag-list))
+ (unless-protected entry-id
+ (exec (sql db "DELETE FROM tagrel WHERE url_id=?;") entry-id)
+ (exec-on-tags (sql db "INSERT OR IGNORE INTO tagrel VALUES (?,?);")
+ mtime entry-id tag-list)))
+
+(defcmd (retag . args)
+ "[[timestamp] entry-id] tag-name [tag-name ...]"
+ "Overwrite tag list for an entry"
+ (apply retag* (time-id-strings args)))
+
(define (tag* mtime entry-id tag-list)
(unless (null? tag-list)
(trace `(tag ,mtime ,entry-id . ,tag-list))