aboutsummaryrefslogtreecommitdiff
path: root/lib/oneliner.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oneliner.lisp')
-rw-r--r--lib/oneliner.lisp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/oneliner.lisp b/lib/oneliner.lisp
index 48c78f6..ccfd3dc 100644
--- a/lib/oneliner.lisp
+++ b/lib/oneliner.lisp
@@ -64,3 +64,34 @@
(or (equal string "")
(and (< 2 (length string))
(ppcre:scan "^[a-zA-Z][a-zA-Z0-9_\-]+$" string))))
+
+;;; PRINTING
+
+(defun print-oneliner-result-for-user (ol)
+ "Prints information about the oneliner to the terminal."
+ (unless *term-width* (set-term-width)) ; setting here as a fallback, can set it elswere if desired.
+ (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~>~%")))
+ (loop repeat *term-width* do (princ #\_))
+ (terpri)
+ (with-slots
+ (id name isflagged islocked runstyle tags createdby brief oneliner) ol
+
+ (format t title-line-format-str
+ id
+ (or name " ")
+ (format nil "~:[ ~;⚠~]~:[ ~;🔒~]~:[ ~;📋~]"
+ isflagged
+ islocked
+ (equalp "manual" runstyle)))
+ (format t tags-line-format-string
+ (format nil "tags: ~{~a~^ ~}" tags)
+ createdby)
+ (loop
+ for x from 0 to (length brief) by *term-width*
+ do (format t "~a~%"
+ (string-trim '(#\space)
+ (alexandria-2:subseq* brief x (+ x *term-width*)))))
+ (format t "~%~a~%~%" oneliner))))