aboutsummaryrefslogtreecommitdiff
path: root/lib/progressbar/init.nom
blob: 98efe1126adf41efac3ad503945415a73304c019 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env nomsu -V6.15.13.8
# A progress bar
    
external:
    ($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[0m[\027[32;40m\($bits, last, rep (floor $x))\$middle\(" ", rep ($w - ((floor $x) + 1)))\027[0m]
        ")
    ($w wide $ progress bar) means (($ * $w) / $w progress bar)