std.print.format
bar-graph
added in 3.0
(bar-graph xs)(bar-graph xs height)constructs a bar graph
(-> (bar-graph (range 10) 6) (str/split-lines)) => " ▟" " ▗██" " ▟███"
border
added in 3.0
(border lines)(border lines width)(border lines width style)formats a border around given lines
justify
added in 3.0
(justify align content length)justifies the content to a given alignment
(justify :right “hello” 10) => “hello”
(justify :left “hello” 10) => "hello "
pad
added in 3.0
(pad len & [pad-char])creates n number of spaces
(pad 1) => "" (pad 5) => ""
pad:center
added in 3.0
(pad:center content length & [pad-char])puts the content at the center, padding missing spacing
(pad:center “hello” 10) => "hello "
pad:left
added in 3.0
(pad:left content length & [pad-char])puts the content to the right, padding missing spaces
(pad:left “hello” 10) => “hello”
pad:right
added in 3.0
(pad:right content length & [pad-char])puts the content to the left, padding missing spaces
(pad:right “hello” 10) => "hello "
report:bold
added in 3.0
(report:bold text)prints the subtitle
(report:bold “Hello Again”)
report:column
added in 3.0
(report:column items name color)prints the column
(report:column [:id.a {:data 100} :id.b {:data 200}] :data #{})
report:header
added in 3.0
(report:header keys {:keys [padding columns], :as params})prints a header for the row
(report:header :id :name :value {:padding 0 :spacing 1 :columns {:align :right :length 10} {:align :center :length 10} {:align :left :length 10}})
report:row
added in 3.0
(report:row row params)prints a row to output
(report:row [“hello” :world (res/result {:data :a :b :c :d :e :f :status :info})] {:padding 0 :spacing 1 :columns {:align :right :length 10} {:align :center :length 10} {:align :left :length 10}})
=> “hello :world [34m[:a :b :c [0m\n 34m :d :e :f[0m”
report:title
added in 3.0
(report:title title)prints the title
(report:title “Hello World”)
sparkline
added in 3.0
(sparkline xs)formats a sparkline
(sparkline (range 8)) => “▁▂▃▅▆▇█”
t:ns
added in 3.0
(t:ns ns)(t:ns ns digits)creates humanised time for nanoseconds
(t:ns 10000 3)
t:time
added in 3.0
(t:time ms)only returns the time (not day) of an instant
(t:time (System/currentTimeMillis))
table
added in 3.0
(table m {:keys [id-key headers sort-key], :as opts})generates a single table
(table {“[email protected]” {:id 1 :value “a”} “[email protected]” {:id 2 :value “b”}} {:headers :id :email :value :sort-key :email :id-key :email}) => (ascii [“| :id | :email | :value |” “|—–+———–+——–|” “| 1 | "" | "a" |[email protected]” “| 2 | "" | "b" |[email protected]”])
table:parse
added in 3.0
(table:parse s {:keys [id-key], :as opts})generates a single table
(table:parse (ascii “| :id | :email | :value |” “|—–+———–+——–|” “| 1 | "[email protected]" | "a" |” “| 2 | "[email protected]" | "b" |”)
{:headers :id :email :value :sort-key :email :id-key :email}) => {“[email protected]” {:id 1 :value “a”} “[email protected]” {:id 2 :value “b”}}
tree-graph
added in 3.0
(tree-graph tree)(tree-graph tree pad prefix check)returns a string representation of a tree
(-> (tree-graph ’[{a “1.1”} [{b “1.2”} {c “1.3”} {d “1.4”}]]) (str/split-lines)) => [“{a "1.1"}” " {b "1.2"}" " {c "1.3"}" " {d "1.4"}" ""]