Indicator
A progress indicator created by
progress.show.
An indicator is either a progress bar (when total is set) or a spinner (when
total is not set). Setting total dynamically switches between the two
modes.
Fields
message
The indicator message text (Str). Read-only — see
update.
icon
The prefix icon (Str). Read-only — see
update.
total
The total value for bar mode (Int), or nil for spinner mode. Read-only —
see update.
position
The current position (Int). Read-only — see
update.
Methods
update :icon? :message? :total? :position? :delta?
Applies one or more changes atomically in a single call — one redraw instead of one per field.
| Name | Type | Description |
|---|---|---|
icon |
Str? |
New prefix icon |
message |
Str? |
New message text |
total |
Int? |
New total; nil switches to spinner mode |
position |
Int? |
Absolute position |
delta |
Int? |
Relative adjustment (positive or negative) |
position and delta are exclusive — passing both raises an error. Omitted
keys are left unchanged.
In non-terminal (plain-text) output, total/position/delta changes are
rate-limited (see progress.with's interval:), but icon/message
changes always print immediately.
delta n?
Adjusts the position by n (default +1). Positive values increment, negative
values decrement. Equivalent to update delta: n but without the overhead of
unpacking unused keys — the common case for a tight loop that only bumps
progress.
| Name | Type | Description |
|---|---|---|
n |
Int |
Amount to adjust (default 1) |