Open utterances-bot opened 2 days ago
added: style each table cell with custom logic.
(update-style-sheet
'((:color :cyan :bold)
(:danger :red :bold)
(:green :green)
(:default :green)
))
(setf *default-cell-style* :green)
(defparameter objects '(("pk" "title" "price")
(1 "lisp" 9.90)
(2 "common lisp" 100)
))
(table objects
:cell-style (lambda (val header)
(when (equal "price" header)
(if (> val 10)
:danger
:color))))
added: the columns adapt their width automatically, we can also set them.
+-------------------------------------+---+-------------------------------------+
|name |age|email |
+-------------------------------------+---+-------------------------------------+
|me |7 |some@blah |
+-------------------------------------+---+-------------------------------------+
|this name is also very very very ver…|7 |some@with-some-very-very-very-very-v…|
+-------------------------------------+---+-------------------------------------+
cl-ansi-term: print tables with style, and other script utilities - Lisp journey
Discovering the Common Lisp language and ecosystem… and being highly productive in it.
https://lisp-journey.gitlab.io/blog/cl-ansi-term--print-tables-with-style-and-other-script-utilities/