Document the progress module.

This commit is contained in:
Dominik Pantůček 2023-03-20 21:02:05 +01:00
parent 019136319f
commit f870430cf1
2 changed files with 41 additions and 3 deletions

View file

@ -50,10 +50,13 @@
(display (sprintf "\r\x1b[K~A" cp)))))
;; Adds something to current progress and refreshes the display.
(define (progress-advance str)
(define (progress-advance . args)
(when (*current-progress*)
(*current-progress* (string-append (*current-progress*) (sprintf "~A" str)))
(print-current-progress)))
(let ((str (if (null? args)
"."
(car args))))
(*current-progress* (string-append (*current-progress*) (sprintf "~A" str)))
(print-current-progress))))
;; Runs given procedure within progress environment
(define (run-with-progress echo? pre-msg post-msg thunk)