std.print.progress

+progress-defaults+

progress

added in 3.0

(progress)(progress initial)(progress initial options)

creates a structure representing progress

(-> (progress) :state deref) => (contains {:total 100, :current 0, :label ""})

progress-bar-string

added in 3.0

(progress-bar-string current total {:keys [width complete incomplete marker]})

converts a progress percentage to a string

(progress-bar-string 50 100 (:bar +progress-defaults+)) => "===================== 50/100 "

progress-eta

added in 3.0

(progress-eta total progress elapsed)

calculates the estimated time left for the task

(progress-eta 100 90 90) => 10

progress-spinner-string

added in 3.0

(progress-spinner-string current total)

converts a progress to a spinner string

(progress-spinner-string 9 20) => “-”

progress-string

added in 3.0

(progress-string progress)(progress-string {:keys [total current label], :as state} {:keys [template bar], :as options})

creates a string representation of the current progress

(progress-string (-> @(:state (progress)) (update :update-time + 10) (update :current + 9)) +progress-defaults+) => “===== 9/100 101s -”

progress-test

added in 3.0

(progress-test)

demo for how progress should work

(progress-test)

progress-update

added in 3.0

(progress-update progress)(progress-update progress number)

updates the progress meter

(progress-update (progress) 10)

replace-center

added in 3.0

(replace-center background text)

replaces the center of the background with text

(replace-center “=================” " hello ") => “===== hello =====”