aboutsummaryrefslogtreecommitdiff
path: root/src/lib.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-03-05 16:02:49 -0600
committerColin Okay <okay@toyful.space>2022-03-05 16:02:49 -0600
commitba5d58c335a69597fcd2531304eee42ef5247b1f (patch)
tree38d17257a63eac9dd58ae12b71f8ed6af2a9bd13 /src/lib.lisp
parent5af85e877f2648f95de882ac0dcffea5f0829c81 (diff)
omit first line of explanation if it is the oneliner text
This should improve readability of the output of the --show option
Diffstat (limited to 'src/lib.lisp')
-rw-r--r--src/lib.lisp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib.lisp b/src/lib.lisp
index 68629e6..9fd75a8 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -195,9 +195,15 @@ and, failing that, try to fetch from configured server."
(with-oneliner (ol name-or-number)
(set-term-width)
(print-oneliner-result-for-user ol)
- (when (getf ol :explanation)
- (princ #\newline)
- (princ (getf ol :explanation)))))
+ (a:when-let (explanation (getf ol :explanation))
+ (format t "EXPLANATION:~%~%")
+ (princ
+ (string-trim
+ '(#\newline #\space #\tab)
+ (if (str:starts-with? (getf ol :oneliner) explanation)
+ (subseq explanation (length (getf ol :oneliner)))
+ explanation)))
+ (terpri))))
;;; API REQUEST FUNCTIONS