def bar

cswap-bend-cli@0.1.0.0 · tui/fmt.bend:185

import cswap-bend-cli@0.1.0.0/tui/fmt.bend as Fmt
import Base

185# A usage bar of `w` cells for a centi-percent (None: an empty track).
186def bar(+pct: Maybe<&2, U32>, +w: Nat, +thr: Maybe<&2, U32>, +stale: Bool) -> List<&2, Seg>:
187  match pct:
188    case None{}:
189      Con{sg(String.repeat("─", w), RTrack{}), Nil{}}
190    case Some{c}:
191      cells(w, 0n, U32.to_nat(((U32.min(c, 10000) * U32.from_nat(w)) / 10000 : U32)), U32.is_ge((((U32.min(c, 10000) * U32.from_nat(w)) % 10000 : U32)), 5000), tick_at(thr, w), severity(c), stale)

Uses (19)

Used by (1)