diff options
-rw-r--r-- | app/account.lisp | 2 | ||||
-rw-r--r-- | app/app.lisp | 8 | ||||
-rw-r--r-- | app/draft.lisp | 4 | ||||
-rw-r--r-- | app/modify.lisp | 2 | ||||
-rw-r--r-- | app/search.lisp | 2 | ||||
-rw-r--r-- | app/util.lisp | 2 | ||||
-rw-r--r-- | lib/client.lisp | 3 | ||||
-rw-r--r-- | lib/oneliner.lisp | 6 | ||||
-rw-r--r-- | lib/state.lisp | 36 |
9 files changed, 35 insertions, 30 deletions
diff --git a/app/account.lisp b/app/account.lisp index bfb4125..71fd83c 100644 --- a/app/account.lisp +++ b/app/account.lisp @@ -83,7 +83,7 @@ (account/redeem/command))) (defun account/handler (cmd) - (cli:print-usage-and-exit cmd t)) + (cli:print-usage cmd t)) (defun account/command () (cli:make-command diff --git a/app/app.lisp b/app/app.lisp index dff5dcb..2a04c1d 100644 --- a/app/app.lisp +++ b/app/app.lisp @@ -38,7 +38,7 @@ (defun toplevel/handler (cmd) "Prints usage statement and then exits" - (cli:print-usage-and-exit cmd *standard-output*)) + (cli:print-usage cmd *standard-output*)) (defun toplevel/command () "Returns the toplevel command object." @@ -54,8 +54,6 @@ (defun main () (ol::with-local-state - (handler-case - (cli:run (toplevel/command))) - (error (e) - (format t "unhandled error ~e~%" e)))) + (cli:run (toplevel/command)) + (format t "moooooo~%"))) diff --git a/app/draft.lisp b/app/draft.lisp index 94489a0..b8cb0e6 100644 --- a/app/draft.lisp +++ b/app/draft.lisp @@ -36,7 +36,7 @@ :usage "<DRAFT> [ARG ...]" :description "runs a draft oneliner, same options as `ol run`" :options (run/options) - :handler #'draft/new/handler)) + :handler #'draft/test/handler)) (defhandler draft/edit/handler (name) (ol:edit-item name t)) @@ -78,7 +78,7 @@ (draft/list/command))) (defun draft/handler (cmd) - (cli:print-usage-and-exit cmd t)) + (cli:print-usage cmd t)) (defun draft/command () (cli:make-command diff --git a/app/modify.lisp b/app/modify.lisp index 0b02371..5ad9655 100644 --- a/app/modify.lisp +++ b/app/modify.lisp @@ -79,7 +79,7 @@ (modify/delete/command))) (defun modify/handler (cmd) - (cli:print-usage-and-exit cmd t)) + (cli:print-usage cmd t)) (defun modify/command () (cli:make-command diff --git a/app/search.lisp b/app/search.lisp index afc8f84..df30526 100644 --- a/app/search.lisp +++ b/app/search.lisp @@ -68,7 +68,7 @@ (ol::all-flagged-oneliners limit)) (t - (cli::print-usage-and-exit cmd t))))) + (cli::print-usage cmd t))))) (defparameter +search/examples+ diff --git a/app/util.lisp b/app/util.lisp index 70dee49..6bcf577 100644 --- a/app/util.lisp +++ b/app/util.lisp @@ -35,4 +35,4 @@ command. (destructuring-bind ,args-pattern (clingon:command-arguments *cmd*) ,@body) (error () - (clingon:print-usage-and-exit *cmd* t))))))) + (clingon:print-usage *cmd* t))))))) 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))))) |