From 70bf3bb2c9cfaab415961f6484b2156ce89619a3 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 1 Apr 2022 15:59:04 -0500 Subject: Squashed commit of the following: commit fabc8a7b9027ff9c312ed45591e75dfd67c21f05 Author: Colin Okay Date: Fri Mar 25 15:51:26 2022 -0500 [add] printing creation date in oneliner printouts commit e95a60bce9d86ca3b2a7cdf41a0c4df3fc5cb3fd Author: Colin Okay Date: Fri Mar 25 15:39:27 2022 -0500 [add] specifically handling dexador's http errors on client commit 4d65d894419c097aa366bc8798e53d7934ea838e Author: Colin Okay Date: Fri Mar 25 15:29:00 2022 -0500 [add] option to show the client version commit c698e20e1a8d0871662413b004a908f20bdb3960 Author: Colin Okay Date: Fri Mar 25 15:17:50 2022 -0500 [bugfix] ecase error handling on bad ol command commit 5e18f28cb59154410d4177f75dfbf24382726a24 Author: Colin Okay Date: Thu Mar 24 17:12:48 2022 -0500 [bugfix] edited oneliners end up in the local cache commit 33e54da2d7c5a012650322d10477154b6a91ba1e Author: Colin Okay Date: Sun Mar 20 07:51:25 2022 -0500 [bugfix] login argument length check was incorrect. commit 2cf6a9883b59fe27fc6cd4888261416a2e929be3 Author: Colin Okay Date: Tue Mar 15 16:33:56 2022 -0500 fixed odd help printout on `ol help` commit 3a19876d855ec8d2279293892e24716b28c4b48a Author: Colin Okay Date: Tue Mar 15 16:29:53 2022 -0500 added --confirm option. refactored run-item & co to accomodate commit fbce85871c6e995ece00e3136cf7dfdeeeff2bb7 Author: Colin Okay Date: Tue Mar 15 15:45:20 2022 -0500 bugfix: handle user interrupt in new and edit commit 130ae266f51f63ac423a65b17749a4d38dda1018 Author: Colin Okay Date: Mon Mar 14 19:36:18 2022 -0500 Added a --verbose / -v option to RUN commit 67c793633bfcd46997155341dd4b1776fb6a6728 Author: Colin Okay Date: Mon Mar 14 19:19:24 2022 -0500 Added help topic explaining icons in printouts commit 08fd723502bb3ee021911c0c9db0f743b575ad68 Author: Colin Okay Date: Mon Mar 14 19:06:36 2022 -0500 Added variables help topic commit 3c8b1804a7e520f465ced563bbf9b416b4abb8ab Author: Colin Okay Date: Mon Mar 14 19:00:54 2022 -0500 added EDITOR CONFIGURATION help topic commit 6dd2563a0f2b848e84f297a0a2296756c65f6246 Author: Colin Okay Date: Mon Mar 14 14:22:09 2022 -0500 made the note while hacking comment more visible commit 1a1de0bb8c18798064d103b70a1c06d20eb3ad05 Author: Colin Okay Date: Mon Mar 14 08:48:50 2022 -0500 moved host assertion inside handler-case commit e2091250cbc8dce679b52636647949d0b417e6be Author: Colin Okay Date: Mon Mar 14 08:21:12 2022 -0500 CONTRIBUTING rewording commit 86f7cdb2ce0f99aee0328617999f35b63694b4a6 Author: Colin Okay Date: Mon Mar 14 08:15:27 2022 -0500 argument checking for run and clip commit f18dddd766af9e06ba4f66487701322de495de59 Author: Colin Okay Date: Mon Mar 14 08:11:58 2022 -0500 tweaks to help menu printing commit 4b390fcde69013393bae325be2e8d2f5944cd15b Author: Colin Okay Date: Sun Mar 13 22:23:46 2022 -0500 tabulating help menu command listing commit 57bae08a8b9accc1d4bfb7165080e7d5a5ef2a30 Author: Colin Okay Date: Sun Mar 13 17:40:45 2022 -0500 deletion support; some cache syncing in client functions; commit 7a97e9d6ba5737f1088dd3a81b9b16121cf47c39 Author: Colin Okay Date: Sun Mar 13 14:45:28 2022 -0500 only print drafts when *drafts* is non null commit 6890b0349f79c0fbbbe5b8b7b3dbf8c2d2262e79 Author: Colin Okay Date: Sun Mar 13 14:43:59 2022 -0500 better printing of drafts commit 6a6c2ec8e2ef6cc9fa91f769d7dbe79387529619 Author: Colin Okay Date: Sun Mar 13 14:39:55 2022 -0500 printing drafts commit 8ba6552132fab6daef1f2b10adf932c87947e2ec Author: Colin Okay Date: Sun Mar 13 14:31:12 2022 -0500 can run the edit command on drafts with --redraft commit 5531288c433641d81d1359e0afa69f86d4bf5d07 Author: Colin Okay Date: Sun Mar 13 14:24:16 2022 -0500 can also edit drafts commit 7bcf634c789c00a95237ad74e5f923a4214020c8 Author: Colin Okay Date: Sun Mar 13 14:21:33 2022 -0500 can make, run, and publish drafts commit 7ae6cbff1875ea271fa1724d6e53bc3d3d48dd26 Author: Colin Okay Date: Sun Mar 13 13:56:49 2022 -0500 support for running drafts; drafts accounted for in with-local-state commit 07183b5bbb4d2e65514e3ec3e7cdf7e421f97749 Author: Colin Okay Date: Sun Mar 13 11:57:06 2022 -0500 added intial drafting code to new commit 80bf9816c6e35bf7ffcc1e4349d5abf056c4df7f Author: Colin Okay Date: Sun Mar 13 11:22:21 2022 -0500 updating helptexts; drafts-file function commit b5b0204d6742c68a90a6388593b980864ae301c3 Author: Colin Okay Date: Sun Mar 13 10:58:19 2022 -0500 removed old main commit 3236933be611f91183ea6b61890c7fbd0b892d8b Author: Colin Okay Date: Sun Mar 13 10:57:54 2022 -0500 removed spurious function commit 3a412cda20b45a2e6617d43e66c6c006924dad88 Author: Colin Okay Date: Sun Mar 13 10:57:05 2022 -0500 cosmetic change to command section printout commit 82a0911f93760a0059addc056340733f8797ae91 Author: Colin Okay Date: Sun Mar 13 10:46:41 2022 -0500 new main in app.lisp; exports to oneliners.cli package commit ebc79c386d4db262ae76bb2ba0386460a35648f9 Author: Colin Okay Date: Sun Mar 13 10:17:18 2022 -0500 tweaks to synopsis definition commit f39523d713c538f81d6f0cdc056fa750ae8a257e Author: Colin Okay Date: Sun Mar 13 09:58:09 2022 -0500 rewrote clon synopsis form --- app/app.lisp | 189 ++++++++++++++++++++++++++++-------------------------- lib/oneliner.lisp | 5 +- lib/state.lisp | 4 ++ lib/util.lisp | 7 ++ 4 files changed, 113 insertions(+), 92 deletions(-) diff --git a/app/app.lisp b/app/app.lisp index 0684824..784d887 100644 --- a/app/app.lisp +++ b/app/app.lisp @@ -215,10 +215,14 @@ Their meaning is as follows: (text :contents "Print information about a contributor.")) (group (:header "EDITOR CONFIGURATION" :hidden t) (text :contents +configure-your-edtior+)) - (group (:header "VARIABLES IN ONELINERS") + (group (:header "VARIABLES IN ONELINERS" :hidden t) (text :contents +oneliners-variables-help-text+)) - (group (:header "ICONS IN PRINTOUT") + (group (:header "ICONS IN PRINTOUT" :hidden t) (text :contents +icons-in-printout-docs+)) + (group (:header "VERSION" :hidden t) + (text :contents "Usage: ol version") + (text :contents " ") + (text :contents "Prints the version of this client.")) (group (:header "HELP MENU") (text :contents "Usage: ol help [SECTION]") (text :contents " ") @@ -233,10 +237,10 @@ Their meaning is as follows: '("search" "run" "clip" "show" "new" "edit" "delete" "drafts" "trash" "publish" "flag" "lock" "redeem" "invite" "login" "whois" - "password" "signature")))) + "password" "signature" "version")))) (text :contents " ") (text :contents "Additional topics include:") -(text :contents + (text :contents (str:join #\newline (tabulate-strings @@ -272,92 +276,97 @@ than the users." (or (parse-integer (first args) :junk-allowed t) (first args))))) (cli:with-local-state - (ecase (a:make-keyword (string-upcase command)) - (:help - (princ #\newline) - (help-topic (or (first args) "help"))) - (:search - (cond - ;; if there are args, use them as search terms - (args - (cli:search-for-oneliners - args - (getopt :long-name "limit") - (getopt :long-name "not-flagged") - (getopt :long-name "all-flagged") - (getopt :long-name "newest"))) - ;; no args, but a --newest flag, just return newest - ((getopt :long-name "newest") - (cli::newest-oneliners (getopt :long-name "limit"))) - ;; no args, but a --all-falgged - ((getopt :long-name "all-flagged") - (cli::all-flagged-oneliners (getopt :long-name "limit"))) - ;; otherwise, print help for search - (t - (help-topic "search") - (uiop:quit)))) - - (:run - (help-and-quit-unless "run" id-or-name) - (cli:run-item id-or-name (rest args) - :verbose (getopt :long-name "verbose") - :confirm (getopt :long-name "confirm") - :timeout (getopt :long-name "timeout") - :draftp (getopt :long-name "draft"))) - (:clip - (help-and-quit-unless "clip" id-or-name) - (cli:run-item id-or-name (rest args) - :force-clip t - :draftp (getopt :long-name "draft"))) - (:show - (help-and-quit-unless "show" id-or-name) - (cli:print-item-explanation id-or-name)) - (:new - (cli:add-new-oneliner)) - (:edit - (help-and-quit-unless "edit" id-or-name) - (cli:edit-item id-or-name (getopt :long-name "redraft"))) - (:delete - (help-and-quit-unless "delete" id-or-name) - (cli::delete-item id-or-name)) - (:publish - (help-and-quit-unless "publish" id-or-name) - (cli::publish-draft id-or-name)) - (:trash - (help-and-quit-unless "trash" id-or-name) - (cli::drop-draft id-or-name)) - (:drafts - (cli::print-drafts)) - (:flag - (help-and-quit-unless "flag" id-or-name) - (cli:flag-item id-or-name)) - (:unflag - (help-and-quit-unless "flag" id-or-name) - (cli:unflag-item id-or-name)) - (:lock - (help-and-quit-unless "lock" id-or-name) - (cli:lock-item id-or-name)) - (:unlock - (help-and-quit-unless "lock" id-or-name) - (cli:unlock-item id-or-name)) - (:redeem - (help-and-quit-unless "redeem" (= 3 (length args))) - (apply 'cli:redeem-invite args)) - (:invite - (cli:request-invite-code)) - (:login - (help-and-quit-unless "login" (= 2 (length args))) - (apply 'cli:login args)) - (:logout - (cli:revoke-access)) - (:password - (help-and-quit-unless "password" (= 3 (length args))) - (apply 'cli:change-pw args)) - (:signature - (cli:change-signature)) - (:whois - (help-and-quit-unless "whois" args) - (cli:show-contributor (first args))))))) + (handler-case + (ecase (a:make-keyword (string-upcase command)) + (:help + (princ #\newline) + (help-topic (or (first args) "help"))) + (:version + (format t "ol v~a~%" +ol-version+ )) + (:search + (cond + ;; if there are args, use them as search terms + (args + (cli:search-for-oneliners + args + (getopt :long-name "limit") + (getopt :long-name "not-flagged") + (getopt :long-name "all-flagged") + (getopt :long-name "newest"))) + ;; no args, but a --newest flag, just return newest + ((getopt :long-name "newest") + (cli::newest-oneliners (getopt :long-name "limit"))) + ;; no args, but a --all-falgged + ((getopt :long-name "all-flagged") + (cli::all-flagged-oneliners (getopt :long-name "limit"))) + ;; otherwise, print help for search + (t + (help-topic "search") + (uiop:quit)))) + + (:run + (help-and-quit-unless "run" id-or-name) + (cli:run-item id-or-name (rest args) + :verbose (getopt :long-name "verbose") + :confirm (getopt :long-name "confirm") + :timeout (getopt :long-name "timeout") + :draftp (getopt :long-name "draft"))) + (:clip + (help-and-quit-unless "clip" id-or-name) + (cli:run-item id-or-name (rest args) + :force-clip t + :draftp (getopt :long-name "draft"))) + (:show + (help-and-quit-unless "show" id-or-name) + (cli:print-item-explanation id-or-name)) + (:new + (cli:add-new-oneliner)) + (:edit + (help-and-quit-unless "edit" id-or-name) + (cli:edit-item id-or-name (getopt :long-name "redraft"))) + (:delete + (help-and-quit-unless "delete" id-or-name) + (cli::delete-item id-or-name)) + (:publish + (help-and-quit-unless "publish" id-or-name) + (cli::publish-draft id-or-name)) + (:trash + (help-and-quit-unless "trash" id-or-name) + (cli::drop-draft id-or-name)) + (:drafts + (cli::print-drafts)) + (:flag + (help-and-quit-unless "flag" id-or-name) + (cli:flag-item id-or-name)) + (:unflag + (help-and-quit-unless "flag" id-or-name) + (cli:unflag-item id-or-name)) + (:lock + (help-and-quit-unless "lock" id-or-name) + (cli:lock-item id-or-name)) + (:unlock + (help-and-quit-unless "lock" id-or-name) + (cli:unlock-item id-or-name)) + (:redeem + (help-and-quit-unless "redeem" (= 3 (length args))) + (apply 'cli:redeem-invite args)) + (:invite + (cli:request-invite-code)) + (:login + (help-and-quit-unless "login" (= 2 (length args))) + (apply 'cli:login args)) + (:logout + (cli:revoke-access)) + (:password + (help-and-quit-unless "password" (= 3 (length args))) + (apply 'cli:change-pw args)) + (:signature + (cli:change-signature)) + (:whois + (help-and-quit-unless "whois" args) + (cli:show-contributor (first args)))) + (#+sbcl sb-kernel:case-failure () + (help-topic "help")))))) (help-topic "help")) (#+sbcl sb-sys:interactive-interrupt #+ccl ccl:interrupt-signal-condition diff --git a/lib/oneliner.lisp b/lib/oneliner.lisp index 668a82c..8386fa9 100644 --- a/lib/oneliner.lisp +++ b/lib/oneliner.lisp @@ -75,7 +75,7 @@ (let* ((title-line-format-str (concatenate 'string "~" (prin1-to-string *term-width*) "<[~a]~;~a~;~a~>~%")) (tags-line-format-string - (concatenate 'string "~" (prin1-to-string *term-width*) "<~a~;by ~a~>~%"))) + (concatenate 'string "~" (prin1-to-string *term-width*) "<~a~;by ~a ~a~>~%"))) (loop repeat *term-width* do (princ #\_)) (terpri) (format t title-line-format-str @@ -87,7 +87,8 @@ (equalp "manual" (oneliner-runstyle ol)))) (format t tags-line-format-string (format nil "tags: ~{~a~^ ~}" (oneliner-tags ol)) - (oneliner-createdby ol)) + (oneliner-createdby 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 5ca5a7b..49cd5d8 100644 --- a/lib/state.lisp +++ b/lib/state.lisp @@ -179,5 +179,9 @@ sets the api's *host* variable. If BODY produces no errors, the " (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))))) diff --git a/lib/util.lisp b/lib/util.lisp index 4b827f1..441b2e0 100644 --- a/lib/util.lisp +++ b/lib/util.lisp @@ -71,6 +71,12 @@ determined by EXECUTABLE-ON-SYSTEM-P." (if what "true" "false")) +(defun datestring-of-universal-time (ut) + (multiple-value-bind + (sec min hour day month year) (decode-universal-time ut) + (declare (ignore sec min hour)) + (format nil "~a-~2,'0d-~2,'0d" year month day))) + (defmacro defplist (name &rest slots) (let* ((slots-names (loop for slot in slots @@ -92,3 +98,4 @@ determined by EXECUTABLE-ON-SYSTEM-P." `(progn ,make-name-defun ,@slot-defuns))) + -- cgit v1.2.3