aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-03-13 14:24:16 -0500
committerColin Okay <okay@toyful.space>2022-03-13 14:24:16 -0500
commit5531288c433641d81d1359e0afa69f86d4bf5d07 (patch)
tree053d048c9c4ef71136cd4bdb2dd5af30bf516d92
parent7bcf634c789c00a95237ad74e5f923a4214020c8 (diff)
can also edit drafts
-rw-r--r--app/app.lisp2
-rw-r--r--lib/client.lisp8
2 files changed, 4 insertions, 6 deletions
diff --git a/app/app.lisp b/app/app.lisp
index 8e89a93..01a88ca 100644
--- a/app/app.lisp
+++ b/app/app.lisp
@@ -232,7 +232,7 @@ than the users."
(:new
(cli:add-new-oneliner))
(:edit
- (cli:edit-item id-or-name))
+ (cli:edit-item id-or-name (getopt :long-name "draft")))
(:publish
(cli::publish-draft id-or-name))
(:flag
diff --git a/lib/client.lisp b/lib/client.lisp
index a72b991..6883b20 100644
--- a/lib/client.lisp
+++ b/lib/client.lisp
@@ -195,11 +195,9 @@ running the body. If such a oneliner can be found."
;;; EDITING ONELINERS
-(defun edit-item (ident)
+(defun edit-item (ident &optional draftp)
(api-token) ;; fails with error if not set.
- (when-oneliner (ol ident)
- ;; Like adding a oneliner, read each field in from a prompt.
- ;; Here, prefil the field with its current value.
+ (let ((ol (if draftp (fetch-draft ident) (the-oneliner ident))))
(let* ((oneliner-string
(prompt "Oneliner: "
:expect 'valid-oneliner-string-p
@@ -270,7 +268,7 @@ running the body. If such a oneliner can be found."
(:body (oneliner-to-json-body local)
:content-type "application/json")
(api:patch--oneliner-entry-edit (oneliner-id ol) :token (api-token))
- ;(merge-oneliners (list new-item)) ;;TODO: this is broken, wait for API update.
+ ;(merge-oneliners (list new-item)) ;;TODO: this is broken, wait for API update.
(format t "Edits accepted~%")))))))
(defun publish-draft (name)