tui progress for viewers
Add a progress bar.
Command Type
built-in
Signature
> tui progress {flags} (source)
Flags
--value, -v {number}: Fixed value to show.--total, -t {number}: Value that fills the bar (default 1, or 100 for values above 1).--label, -l {string}: Text before the percentage.--id {string}: Widget id.--focus: Start with this widget focused.--data {any}: Data for this widget alone, instead of the outer pipeline's. Not with --from or a closure.--from {string}: Id of the table, tree, or select whose highlighted row drives this widget.
Parameters
source: Closure over the highlighted row of --from, or of the nearest table, tree, or select, that yields the value.
Input/output types:
| input | output |
|---|---|
| nothing | tui |
| tui | tui |
| any | tui |
Examples
A static bar at 40%
> tui progress --value 0.4 --label copying | tui debug | get screenA bar driven by a stream
> 1..100 | each {|n| sleep 50ms; $n } | tui progress --total 100 | tui runNotes
The bar shows --value, or otherwise reads its data: a number, a {value, total} record's value, or the last number in a list, so a streamed counter drives it live. Values above 1 are read out of --total (default 100).
With a closure the bar follows the highlighted row of a table, tree, or select instead, e.g. tui progress --from table-0 {|row| $row.pct }. It follows the one named by --from, else the focused one, else the nearest, which may be on another tab page. A closure with no table, tree, or select to follow is an error when the TUI starts. --value and --data cannot be combined with --from or a closure.