diff options
author | Colin Okay <okay@toyful.space> | 2022-03-11 10:33:19 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-03-11 10:33:19 -0600 |
commit | 6d706967f1de63de80c83766053e896ab4792420 (patch) | |
tree | 99e1ef623cced4d22e1d6947c3779f35e82158f2 /lib/oneliner.lisp | |
parent | 8f9b59690660f85aeae675989fe9fe6b1b830445 (diff) |
refactoring client functions
Diffstat (limited to 'lib/oneliner.lisp')
-rw-r--r-- | lib/oneliner.lisp | 31 |
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)))) |