aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-28 15:23:55 -0600
committerColin Okay <okay@toyful.space>2022-02-28 15:23:55 -0600
commit50de25d9728ed7da8147142e659857bbfbc754d1 (patch)
tree4a6a2cef2fdfb3a2843b85b0eeb717bf2caf5281 /src
parentfc55695743a15e8e3945b2e5718763378a5ae362 (diff)
edits update local cache. revoke renamed logout
Diffstat (limited to 'src')
-rw-r--r--src/lib.lisp45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/lib.lisp b/src/lib.lisp
index e81c7af..7df571b 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -340,17 +340,20 @@ the directories that appear in the value of that variable."
(explanation
(when (y-or-n-p "Provide an explanation?")
(string-from-editor (getf ol :explanation)))))
- (api:request-with
- (:host (host)
- :body (jonathan:to-json
- (list :oneliner oneliner
- :tags tags
- :brief brief
- :explanation explanation
- :runstyle runstyle))
- :content-type "application/json")
- (api:patch--oneliner-entry-edit (getf ol :id) :token (api-token))
- (format t "OK~%")))))
+ (let ((new-item
+ (list :oneliner oneliner
+ :tags tags
+ :brief brief
+ :explanation explanation
+ :runstyle runstyle)))
+ (api:request-with
+ (:host (host)
+ :body (jonathan:to-json
+ new-item)
+ :content-type "application/json")
+ (api:patch--oneliner-entry-edit (getf ol :id) :token (api-token))
+ (update-history-item n new-item)
+ (format t "OK~%"))))))
(defun request-invite-code ()
(ensure-config)
@@ -370,7 +373,7 @@ the directories that appear in the value of that variable."
:content-type "application/json")
(api:post--access))))
(setf (api-token) (getf response :token)
- (contributor-handle) handle)
+ (contributor-handle) user)
(write-config-to-disk)
(format t "Access token written to ~a~%You may now make contributions to the wiki!.~%"
(config-file))))
@@ -421,6 +424,14 @@ the directories that appear in the value of that variable."
(:host (host))
(api:delete--access-access (api-token) :token (api-token))))
+(defun update-history-item (n item)
+ (when (uiop:file-exists-p (last-search-file))
+ (let* ((results (with-open-file (input (last-search-file)) (read input)))
+ (ol (nth (1- n) results)))
+ (when ol
+ (setf (nth (1- n) results) (append item ol))
+ (cache-search-results-to-last-search-file results)))))
+
(defun cache-search-results-to-last-search-file (results)
(with-open-file (output (last-search-file) :direction :output :if-exists :supersede)
(print results output)))
@@ -518,11 +529,11 @@ printed to OUTPUT-STREAM. "
(shell-output (uiop:process-info-output shell)))
(write-line command shell-input)
(finish-output shell-input)
- (if (and await-output-p
- (wait-until (:timeout await-output-p :poll-every 0.005)
- (listen shell-output)))
+ (if (and await-output-p
+ (plusp await-output-p)
+ (wait-until (:timeout await-output-p :poll-every 0.005)
+ (listen shell-output)))
(loop while (listen shell-output)
do (princ (read-line shell-output) output-stream)
- (terpri output-stream))
- (format t "Timed out waiting for output. Try a longer --timeout.~%")))))
+ (terpri output-stream))))))