aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-app.lisp15
-rw-r--r--src/lib.lisp15
2 files changed, 26 insertions, 4 deletions
diff --git a/build-app.lisp b/build-app.lisp
index 284feaa..8122b1e 100644
--- a/build-app.lisp
+++ b/build-app.lisp
@@ -43,15 +43,18 @@ my1337pw.")
(text :contents " ")
(text :contents "Runs the Nth search result with possible arguments ARGS.")
(flag :long-name "clip"
- :description "Force an attempt to copy the oneliner to the clipboard instead of running it."))
+ :description "Put oneliner into clipboard instead of running it."))
(text :contents " ")
(group (:header "Help")
+ (flag :long-name "explain"
+ :description "View oneliner explaination text.")
(flag :long-name "help"
:description "Print this help menu.")
(enum :long-name "help-topic"
:enum '(:access :wiki :invites)
:argument-name "TOPIC"
- :description "Print help for a topic. Topics are: wiki, access, invites"))
+ :description "Print help for a topic.
+Topics: wiki, access, invites"))
(group (:header "Wiki" :hidden t)
(flag :long-name "add"
:description "Intaractively add a oneliner and update the wiki.")
@@ -136,6 +139,8 @@ than the users."
(cli::unlock-item hist-number))
((getopt :long-name "edit")
(cli::edit-item hist-number))
+ ((getopt :long-name "explain")
+ (cli::print-item-explanation hist-number))
(t
(cli::run-item hist-number (rest arguments) (getopt :long-name "clip"))))
(uiop:quit))
@@ -148,6 +153,12 @@ than the users."
(uiop:quit))
(error (e)
(format *error-output* "~%ERROR: ~a~%" e)
+ (uiop:quit))
+ (#+sbcl sb-sys:interactive-interrupt
+ #+ccl ccl:interrupt-signal-condition
+ #+ecl ext:interactive-interrupt
+ ()
+ (format t "Aborted by User Interrupt.~%")
(uiop:quit))))
;;; DUMP EXECUTABLE
diff --git a/src/lib.lisp b/src/lib.lisp
index 147e294..680e93a 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -93,12 +93,16 @@ the directories that appear in the value of that variable."
(defun tags-from-oneliner (oneliner)
(remove-if-not #'executable-on-system-p (ppcre:split " +" oneliner)))
+
+
+(rl:register-hook :signal (lambda () (uiop:quit)))
+
(defun prompt (prompt
&key
(expect (constantly t))
retry-text
(prefill ""))
- ;; register a prefil hook
+ ;; register a prefill hook
(rl:register-hook
:pre-input
(lambda ()
@@ -135,6 +139,12 @@ the directories that appear in the value of that variable."
;;; API REQUEST FUNCTIONS
+(defun print-item-explanation (number)
+ (with-cached-result (ol number)
+ (when (getf ol :explanation)
+ (princ #\newline)
+ (princ (getf ol :explanation)))))
+
(defun flag-item (item-number)
(with-cached-result (ol item-number)
(ensure-config)
@@ -250,7 +260,8 @@ the directories that appear in the value of that variable."
:prefill "auto")))
(explanation
(when (y-or-n-p "Provide an explanation?")
- (string-from-editor))))
+ (string-from-editor
+ (format nil "~a~%~%" oneliner)))))
(api:request-with
(:host (host)
:body (jonathan:to-json