From ba5d58c335a69597fcd2531304eee42ef5247b1f Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sat, 5 Mar 2022 16:02:49 -0600 Subject: omit first line of explanation if it is the oneliner text This should improve readability of the output of the --show option --- src/lib.lisp | 12 +++++++++--- 1 file 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 -- cgit v1.2.3