diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/client.lisp | 3 | ||||
-rw-r--r-- | lib/oneliner.lisp | 6 | ||||
-rw-r--r-- | lib/state.lisp | 36 |
3 files changed, 26 insertions, 19 deletions
diff --git a/lib/client.lisp b/lib/client.lisp index e3f304e..13bf2fe 100644 --- a/lib/client.lisp +++ b/lib/client.lisp @@ -86,7 +86,8 @@ running the body. If such a oneliner can be found." (when *drafts* (format t (concatenate 'string "~%~" (prin1-to-string *term-width*) "< ~;DRAFTS~; ~>~%")) (dolist (draft *drafts*) - (print-oneliner-result-for-user (cdr draft))))) + (format t "Draft Name: ~a~%" (first draft)) + (print-oneliner-result-for-user (rest draft))))) ;;; RUNNING ONELINERS diff --git a/lib/oneliner.lisp b/lib/oneliner.lisp index 8386fa9..3935a0e 100644 --- a/lib/oneliner.lisp +++ b/lib/oneliner.lisp @@ -87,8 +87,10 @@ (equalp "manual" (oneliner-runstyle ol)))) (format t tags-line-format-string (format nil "tags: ~{~a~^ ~}" (oneliner-tags ol)) - (oneliner-createdby ol) - (datestring-of-universal-time (oneliner-createdat ol))) + (or (oneliner-createdby ol) " ") + (if (oneliner-createdat ol) + (datestring-of-universal-time (oneliner-createdat ol)) + " ")) (loop for x from 0 to (length (oneliner-brief ol)) by *term-width* do (format t "~a~%" diff --git a/lib/state.lisp b/lib/state.lisp index 49cd5d8..e690f37 100644 --- a/lib/state.lisp +++ b/lib/state.lisp @@ -169,19 +169,23 @@ sets the api's *host* variable. If BODY produces no errors, the " `(let* ((*config* (ensure-config)) (*cache* (read-cache-file)) (*drafts* (read-drafts-file)) - (api:*host* (config-host *config*))) - (handler-case - (progn - (assert api:*host* () "ol must be configured with a server host.") - (set-term-width) - ,@body - ;; only if there is no error do we save the local state. - (write-drafts-to-disk) - (write-cache-to-disk) - (write-config-to-disk)) - (dexador.error:http-request-failed (e) - (format *error-output* "Operation failed. The server at ~a returned with ~a~%" - api:*host* - (dexador.error:response-status e))) - (error (e) - (format *error-output* "~a~%" e))))) + (api:*host* (config-host *config*)) + (errorsp nil)) + (unwind-protect + (handler-case + (progn + (assert api:*host* () "ol must be configured with a server host.") + (set-term-width) + ,@body) + (dexador.error:http-request-failed (e) + (setf errorsp t) + (format *error-output* "Operation failed. The server at ~a returned with ~a~%" + api:*host* + (dexador.error:response-status e))) + (error (e) + (setf errorsp t) + (format *error-output* "Unknown Error: ~a~%" e))) + (unless errorsp + (write-drafts-to-disk) + (write-cache-to-disk) + (write-config-to-disk))))) |