chickadee » progress-indicators

progress-indicators

Introduction

Shows text-mode progress-indicators.

Usage

 (require-extension progress-indicators)

Requirements

defstruct

Documentation

(make-progress-bar #!key fill empty head frame value max width port end-message) procedure

Creates an object representing a progress-bar. The keyword arguments customize the appearance of the progress-bar, when it is shown and default to the following values:

fill#\=
empty#\space
head#\>
frame"[~a~a~a~a|~a]"
max100
width60
port(current-output-port)
end-message" finished"
(progress-bar? X) procedure

Returns #t if X is an object representing a progress-bar, or #f otherwise.

(progress-bar-value PBAR) procedure

Returns the current value of the given progress bar. You can also use SRFI-17 "setter" syntax to modify the current value (causing a redisplay):

 (set! (progress-bar-value PBAR) VALUE)
(show-progress-bar PBAR) procedure

Redisplays the progress-bar PBAR.

(advance-progress-bar! PBAR [AMOUNT]) procedure

Increases the current value of the progress-bar PBAR by AMOUNT, which defaults to 1 and redisplays it.

(finish-progress-bar! PBAR [CLEAR]) procedure

Sets the value of PBAR to the maximum, writes the end-message and prints a newline. The progress-bar should not be reused after this procedure has been called. If CLEAR is given and true, remove the bar.

(make-spinner #!key value port steps) procedure

Creates an object representing a "spinner" progress-indicator. The keyword arguments customize the appearance of the progress-bar, when it is shown and default to the following values:

steps"|/-\\"
port(current-output-port)
(spinner? X) procedure

Returns #t if X is an object representing a spinner, or #f otherwise.

(advance-spinner! SPINNER) procedure

Advances the given spinner by 1 step and redisplays it.

(finish-spinner! SPINNER) procedure

Clears the spinner. It should not be used after this procedure has been called.

Author

felix winkelmann

License

This code is placed into the public domain.

Version History

0.3
added missing license information
0.2
added optional "clear" argument to finish-progress-bar!
0.1
initial release

Contents »