diff options
author | Tom Willemsen | 2013-03-23 13:38:19 +0100 |
---|---|---|
committer | Tom Willemsen | 2013-03-23 13:38:19 +0100 |
commit | cbe1830f836771cb7b2a6241d0eba33eb4876133 (patch) | |
tree | 84f948202199144cce84d5c520eba67afcb99ef4 | |
parent | dd47751a43773cc9a1732e3665940da539bdc150 (diff) | |
download | clark-cbe1830f836771cb7b2a6241d0eba33eb4876133.tar.gz clark-cbe1830f836771cb7b2a6241d0eba33eb4876133.zip |
Add exists command
This command shows whether or not the given url is known to CLark.
-rw-r--r-- | lisp/clark.lisp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/clark.lisp b/lisp/clark.lisp index 256bcdd..5dc294b 100644 --- a/lisp/clark.lisp +++ b/lisp/clark.lisp @@ -134,14 +134,25 @@ BM should be a list containing the url and name of the bookmark." (format t "~A~%~A~%~%" url name))) (defcommand add - "Add a new bookmark." + "Add a new bookmark." (with-transaction *db* (destructuring-bind (url name description &rest tags) args (insert-bookmark url name description) (add-tags tags)))) +(defcommand exists + "Check if a bookmark exists in the database." + (if (execute-single *db* "SELECT rowid FROM bookmark WHERE url = ?" + (car args)) + (progn + (format t "yes~%") + 0) + (progn + (format t "no~%") + 1))) + (defcommand help - "Show help message." + "Show help message." (declare (ignore args)) (format t (concatenate 'string @@ -157,7 +168,7 @@ BM should be a list containing the url and name of the bookmark." name short))) *help-messages*)) (defcommand search - "Search through bookmarks." + "Search through bookmarks." (map nil (lambda (bm) (destructuring-bind (url name description) bm @@ -174,7 +185,7 @@ BM should be a list containing the url and name of the bookmark." (format nil "%~A%" (car args)) (car args)))) (defcommand version - "Show version." + "Show version." (declare (ignore args)) (format t "clark version ~A~%" *version*)) |