The progress-stream Library¶
Many text-mode programs that perform long-running, non-interactive tasks (such as compilers) provide a running indication of what fraction of the task is complete using a bar graph drawn using text characters. This library implements a wrapper stream that interleaves the progress bar graph with any status output. When output is not directed to a console then progress updates are ignored.
- <progress-stream> Abstract Instantiable Class¶
- Superclasses:
- Init-Keywords:
force? – If true, forces the wrapped stream to be treated as a console, allowing textual progress bar output.
- Keyword:
bar-width: An instance of
<integer>
representing the number of bar characters to be included in textual progress bar output. Defaults to 40.- Keyword:
line-width: An instance of
<integer>
representing the total line width (including both progress bar and label) in characters. Defaults to 79.
- show-progress Generic function¶
- Signature:
show-progress (stream position range #key label) => ()
- Parameters:
stream – An instance of
<progress-stream>
.position – An instance of
<integer>
.range – An instance of
<integer>
.label (#key) – An instance of
<object>
.
- Discussion:
Graphically displays the current progress, proportional to position divided by range, to the given stream. In the case where stream is a console (i.e., unredirected
*standard-output*
),show-progress
will draw a textual progress bar with overall width configured in the<progress-stream>
instance.
- stream-supports-show-progress? Generic function¶
- Signature:
stream-supports-show-progress? (stream) => (supports-show-progress?)
- Parameters:
stream – An instance of
<stream>
.
- Values:
supports-show-progress? – An instance of
<boolean>
.
- Discussion:
Returns a true value if the stream argument can usefully support the
show-progress
operation.