Determinate progress indicator (aka a "progress bar"), for the case where the progress of a long-running task can be determined.
Determinate progress indicator (aka a "progress bar"), for the case where the progress of a long-running task can be determined.
(animate! a & body)
Wraps execution of the given forms in a determinate progress indicator,
monitoring atom a
(a number between 0
and (:total opts)
, representing
progress). If the first form is the keyword :opts
, the second form must be
a map, containing any/all of these keys:
:style
- a map defining the style (characters, colours, and
attributes) to use when printing the progress indicator.
Optional, default: (:ascii-basic styles)
:label
- a String
to display before the progress indicator - this
could be the filename for a lengthy file download, for
example. Optional, default: nil
:line
- the line number on the screen at which to display the
progress indicator (note: 1-based). Optional, default: nil
(display at current location):width
- the (approximate) desired width of the progress indicator,
including any labels and counters. This is approximate
because emoji-based styles may not take up an even fraction
of the desired width. Optional, default: 72
:total
- the final number that the atom will reach. Optional, default:
100
(i.e. the atom represents a %age):units
- a unit label (String
) to display after the counter - this
could be a file size unit ("KB"
, "MB"
, etc.), for
example. Optional, default: nil
:preserve?
- flag indicating whether to preserve the progress indicator on
screen after it finishes (vs erasing it). Optional, default:
false
(erase it):counter?
- whether to display a counter to the right of the progress
indicator. Optional, default: true
(display a counter)Wraps execution of the given forms in a determinate progress indicator, monitoring atom `a` (a number between `0` and `(:total opts)`, representing progress). If the first form is the keyword `:opts`, the second form _must_ be a map, containing any/all of these keys: * `:style` - a map defining the style (characters, colours, and attributes) to use when printing the progress indicator. Optional, default: `(:ascii-basic styles)` * `:label` - a `String` to display before the progress indicator - this could be the filename for a lengthy file download, for example. Optional, default: `nil` * `:line` - the line number on the screen at which to display the progress indicator (note: 1-based). Optional, default: `nil` (display at current location) * `:width` - the (approximate) desired width of the progress indicator, including any labels and counters. This is approximate because emoji-based styles may not take up an even fraction of the desired width. Optional, default: `72` * `:total` - the final number that the atom will reach. Optional, default: `100` (i.e. the atom represents a %age) * `:units` - a unit label (`String`) to display after the counter - this could be a file size unit (`"KB"`, `"MB"`, etc.), for example. Optional, default: `nil` * `:preserve?` - flag indicating whether to preserve the progress indicator on screen after it finishes (vs erasing it). Optional, default: `false` (erase it) * `:counter?` - whether to display a counter to the right of the progress indicator. Optional, default: `true` (display a counter)
(animatef! a f)
(animatef! a opts f)
Wraps execution of the given function in a determinate progress indicator,
monitoring atom a
(a number between 0
and (:total opts)
, representing
progress).
Note: the animate!
macro is preferred over this function.
The optional opts
map may have an/all of these keys:
:style
- a map defining the style (characters, colours, and
attributes) to use when printing the progress indicator.
Optional, default: (:ascii-basic styles)
:label
- a String
to display before the progress indicator - this
could be the filename for a lengthy file download, for
example. Optional, default: nil
:line
- the line number on the screen at which to display the
progress indicator (note: 1-based). Optional, default: nil
(display at current location):width
- the (approximate) desired width of the progress indicator,
including any labels and counters. This is approximate
because emoji-based styles may not take up an even fraction
of the desired width. Optional, default: 72
:total
- the final number that the atom will reach. Optional, default:
100
(i.e. the atom represents a %age):units
- a unit label (String
) to display after the counter - this
could be a file size unit ("KB"
, "MB"
, etc.), for
example. Optional, default: nil
:preserve?
- flag indicating whether to preserve the progress indicator on
screen after it finishes (vs erasing it). Optional, default:
false
(erase it):counter?
- whether to display a counter to the right of the progress
indicator. Optional, default: true
(display a counter)Wraps execution of the given function in a determinate progress indicator, monitoring atom `a` (a number between `0` and `(:total opts)`, representing progress). **Note: the [[animate!]] macro is preferred over this function.** The optional `opts` map may have an/all of these keys: * `:style` - a map defining the style (characters, colours, and attributes) to use when printing the progress indicator. Optional, default: `(:ascii-basic styles)` * `:label` - a `String` to display before the progress indicator - this could be the filename for a lengthy file download, for example. Optional, default: `nil` * `:line` - the line number on the screen at which to display the progress indicator (note: 1-based). Optional, default: `nil` (display at current location) * `:width` - the (approximate) desired width of the progress indicator, including any labels and counters. This is approximate because emoji-based styles may not take up an even fraction of the desired width. Optional, default: `72` * `:total` - the final number that the atom will reach. Optional, default: `100` (i.e. the atom represents a %age) * `:units` - a unit label (`String`) to display after the counter - this could be a file size unit (`"KB"`, `"MB"`, etc.), for example. Optional, default: `nil` * `:preserve?` - flag indicating whether to preserve the progress indicator on screen after it finishes (vs erasing it). Optional, default: `false` (erase it) * `:counter?` - whether to display a counter to the right of the progress indicator. Optional, default: `true` (display a counter)
The default determinate progress indicator style used, if one isn't
specified, as a keyword
that has an associated entry in [styles]. This style
is known to function on all platforms.
The default determinate progress indicator style used, if one isn't specified, as a `keyword` that has an associated entry in [styles]. This style is known to function on all platforms.
A selection of predefined styles of determinate progress indicators,
represented as a map
. Only ASCII progress indicators are known to work
reliably - other styles depend on the operating system, terminal font &
encoding, phase of the moon, and how long since your dog last pooped.
A selection of predefined styles of determinate progress indicators, represented as a `map`. Only ASCII progress indicators are known to work reliably - other styles depend on the operating system, terminal font & encoding, phase of the moon, and how long since your dog last pooped.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close