iens

Manager of links to read
git clone https://git.instinctive.eu/iens.git
Log | Files | Refs | README | LICENSE

commit 47dc57b6fa665d15d5818ca4361ed5d4aeafac27
parent 16a9e22f4cfa39ae0ba62b7cd93cdcdb81a56452
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Wed,  7 Feb 2024 22:25:51 +0000

Commands for arbitrary SQL query listing of entries
Diffstat:
Msrc/iens.scm | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/iens.scm b/src/iens.scm @@ -437,6 +437,13 @@ vt100-reset)) (write-string notes)) +(defcmd (list-selection str) + "\"WHERE ...\"" "Display a custom query as a lit" + (query (for-each-row* print-listed-entry-row) + (sql/transient db + (string-append "SELECT id,url,notes,protected FROM entry " + str ";")))) + (defcmd (list-tagged tag-name . args) "tag-name [limit]" "Display entries with the given tag" (query (for-each-row* print-listed-entry-row) @@ -475,6 +482,19 @@ (print-entry* (car todo)) (loop (cdr todo)))))) +(defcmd (print-selection str) + "\"WHERE ...\"" "Display a custom query as a lit" + (query (for-each-row* print-entry-row) + (sql/transient db + (string-append + "SELECT entry.id,url,type,description,notes, + protected,ptime,ctime,mtime,group_concat(tag.name,' ') + FROM entry + LEFT OUTER JOIN tagrel ON entry.id=tagrel.url_id + LEFT OUTER JOIN tag ON tag.id=tagrel.tag_id " + str + " GROUP BY entry.id;")))) + (defcmd (random-tagged tag-name) "tag" "Select a random entry with the given tag" (let ((entry-id (query fetch-value