blob: a7ff5aad69e8ee1682ae9e547ea90516071e5038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# A progress bar
externally ($x / $w progress bar) means:
$x = ($x clamped between 0 and $w)
$bits = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█"]
$middle =
"" if ($x == $w) else
$bits.(1 + (floor ((#$bits) * ($x mod 1))))
return ("
\027[32;40m\($bits, last, rep (floor $x))\$middle\
..\(" ", rep ($w - ((floor $x) + 1)))\027[0m
")
externally ($w wide $ progress bar) means
($ * $w) / $w progress bar
|