Add tables and spinners

This commit is contained in:
Dimitri Lozeve 2021-11-22 18:29:40 +01:00
parent 51f5e862a3
commit ac81aeaddc
5 changed files with 77 additions and 3 deletions

19
spinner.scm Normal file
View file

@ -0,0 +1,19 @@
(define +spinner-styles+
'((dots . "⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
(block . "▖▘▝▗")
(triangle . "◢◣◤◥")
(circle . "◐◓◑◒")
(vertical . "▁▃▄▅▆▇█▇▆▅▄▃")
(horizontal . "▉▊▋▌▍▎▏▎▍▌▋▊▉")
(ascii . "|/-\\")))
(define (spinner i text-before text-after #!key (style 'dots))
(define spinner-chars (cdr (assoc style +spinner-styles+)))
(string-append
(cursor-up 1)
(parse-markup text-before)
" "
(string (string-ref spinner-chars (modulo i (string-length spinner-chars))))
" "
(parse-markup text-after)
"\n"))