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-messageprocedure

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? Xprocedure

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

progress-bar-value PBARprocedure

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 PBARprocedure

Redisplays the progress-bar PBAR.

advance-progress-bar! PBAR #!optional AMOUNTprocedure

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

finish-progress-bar! PBAR #!optional CLEARprocedure

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 stepsprocedure

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? Xprocedure

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

advance-spinner! SPINNERprocedure

Advances the given spinner by 1 step and redisplays it.

finish-spinner! SPINNERprocedure

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 »