Add exists command
This command shows whether or not the given url is known to CLark.
This commit is contained in:
parent
dd47751a43
commit
cbe1830f83
1 changed files with 15 additions and 4 deletions
|
@ -134,14 +134,25 @@ BM should be a list containing the url and name of the bookmark."
|
||||||
(format t "~A~%~A~%~%" url name)))
|
(format t "~A~%~A~%~%" url name)))
|
||||||
|
|
||||||
(defcommand add
|
(defcommand add
|
||||||
"Add a new bookmark."
|
"Add a new bookmark."
|
||||||
(with-transaction *db*
|
(with-transaction *db*
|
||||||
(destructuring-bind (url name description &rest tags) args
|
(destructuring-bind (url name description &rest tags) args
|
||||||
(insert-bookmark url name description)
|
(insert-bookmark url name description)
|
||||||
(add-tags tags))))
|
(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
|
(defcommand help
|
||||||
"Show help message."
|
"Show help message."
|
||||||
(declare (ignore args))
|
(declare (ignore args))
|
||||||
(format t (concatenate
|
(format t (concatenate
|
||||||
'string
|
'string
|
||||||
|
@ -157,7 +168,7 @@ BM should be a list containing the url and name of the bookmark."
|
||||||
name short))) *help-messages*))
|
name short))) *help-messages*))
|
||||||
|
|
||||||
(defcommand search
|
(defcommand search
|
||||||
"Search through bookmarks."
|
"Search through bookmarks."
|
||||||
(map
|
(map
|
||||||
nil (lambda (bm)
|
nil (lambda (bm)
|
||||||
(destructuring-bind (url name description) 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))))
|
(format nil "%~A%" (car args)) (car args))))
|
||||||
|
|
||||||
(defcommand version
|
(defcommand version
|
||||||
"Show version."
|
"Show version."
|
||||||
(declare (ignore args))
|
(declare (ignore args))
|
||||||
(format t "clark version ~A~%" *version*))
|
(format t "clark version ~A~%" *version*))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue