diff options
author | Colin Okay <okay@toyful.space> | 2022-03-13 14:39:55 -0500 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-03-13 14:39:55 -0500 |
commit | 6a6c2ec8e2ef6cc9fa91f769d7dbe79387529619 (patch) | |
tree | 408b212bf6720fd97c1e264d641a5cbe830f76f5 | |
parent | 8ba6552132fab6daef1f2b10adf932c87947e2ec (diff) |
printing drafts
-rw-r--r-- | app/app.lisp | 16 | ||||
-rw-r--r-- | lib/client.lisp | 7 | ||||
-rw-r--r-- | lib/state.lisp | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/app/app.lisp b/app/app.lisp index 08e203e..bac6628 100644 --- a/app/app.lisp +++ b/app/app.lisp @@ -128,10 +128,18 @@ export EDITOR=/usr/bin/zile (text :contents "Options:") (flag :long-name "redraft" :description "Indicates that you wish to edit a draft instead of a published oneliner.")) - (group (:header "PUBLISHING ONELINERS" :hidden t) + (group (:header "PUBLISHING ONELINER DRAFTS" :hidden t) (text :contents "Usage: ol publish <DRAFT>") (text :contents " ") (text :contents "Submits a draft oneliner to the wiki server, and, when successful, deletes the draft.")) + (group (:header "DRAFTS LISTING" :hidden t) + (text :contents "Usage: ol drafts") + (text :contents " ") + (text :contents "Prints a listing of current drafts of oneliners yet to be published.")) + (group (:header "TRASH DRAFT" :hidden t) + (text :contents "Usage: ol trash <DRAFT>") + (text :contents " ") + (text :contents "Trashes a draft.")) (group (:header "FLAGGING AND UNFLAGGING ONELINERS" :hidden t) (text :contents "Usage: ol <flag | unflag> <IDENTIFIER>") (text :contents " ") @@ -179,6 +187,8 @@ export EDITOR=/usr/bin/zile (text :contents "show") (text :contents "new") (text :contents "edit") + (text :contents "drafts") + (text :contents "trash") (text :contents "publish") (text :contents "flag") (text :contents "lock") @@ -239,6 +249,10 @@ than the users." (cli:edit-item id-or-name (getopt :long-name "redraft"))) (:publish (cli::publish-draft id-or-name)) + (:trash + (cli::drop-draft id-or-name)) + (:drafts + (cli::print-drafts)) (:flag (cli:flag-item id-or-name)) (:unflag diff --git a/lib/client.lisp b/lib/client.lisp index 233cc42..530b454 100644 --- a/lib/client.lisp +++ b/lib/client.lisp @@ -21,7 +21,7 @@ ;; WITH-LOCAL-STATE form. If you are hacking in the REPL, make sure ;; to wrap function calls appropriately. -;;; GETTING ONELINERS & Displaying oneliners +;;; GETTING ONELINERS & DISPLAYING ONELINERS (defun search-for-oneliners (terms limit &optional not-flagged-p all-flagged-p newestp) (assert (loop for term in terms never (find #\, term)) () "Search terms may not contain commas.") @@ -78,6 +78,11 @@ running the body. If such a oneliner can be found." (princ #\newline) (princ (oneliner-explanation ol))))) +(defun print-drafts () + (format t "DRAFTS~%") + (dolist (draft *drafts*) + (print-oneliner-result-for-user (cdr draft)))) + ;;; RUNNING ONELINERS (defvar *ol-output-timeout* 1) diff --git a/lib/state.lisp b/lib/state.lisp index 8ab6c51..9c25ab6 100644 --- a/lib/state.lisp +++ b/lib/state.lisp @@ -90,7 +90,7 @@ (defun drop-draft (name) "Drop a draft by NAME from the *DFRAFTS* association list." - (setf *DRAFTS* (delete (assoc name *DRAFTS*) *DRAFTS*))) + (setf *DRAFTS* (delete (assoc name *DRAFTS* :test #'string-equal) *DRAFTS*))) (defun put-draft (name draft) "Modifies *DRAFTS*, adding a new DRAFT associated with NAME. If NAME |