progrock.core

A namespace for generating textual progress bars in a functional way.

default-render-options

A map of default options for the render function.

done

(done bar)
Return a new progress bar that has been marked as 'done'.

elapsed-time

(elapsed-time {:keys [creation-time]})

percent

(percent {:keys [progress total]})

print

(print bar)(print bar options)
Prints a progress bar, overwriting any existing progress bar on the same
line. If the progress bar is done, a new line is printed.

progress-bar

(progress-bar total)
Create an immutable data structure representing a progress bar for the
specified total.

remaining-time

(remaining-time {:keys [progress total], :as bar})

render

(render bar)(render {:keys [progress total], :as bar} options)
Render a progress bar as a string. Takes an optional map of profiles, which
connects state keywords to maps of display options. The following display
options are allowed:

  :format     - a format string for the progress bar
  :length     - the length of the bar
  :complete   - the character to use for a completed chunk
  :incomplete - the character to use for an incomplete chunk

The format string determines how the bar is displayed, with the following
subsitutions:

  :bar       - the progress bar itself
  :progress  - the number of complete items
  :total     - the total number of items
  :percent   - the percentage done
  :elapsed   - the elapsed time in minutes and seconds
  :remaining - the estimated remaining time in minutes and seconds

tick

(tick bar)(tick bar amount)
Return a new progress bar that has been incremented by the supplied amount,
or by 1, if no amount was supplied.