def usage_rest
cli@0.2.0.0 · cli.bend:5291
import cli@0.2.0.0/cli.bend as Cli
import Base
5291
5292def usage_rest(elems: List<&2, Segment>, +w: Nat, +col: Nat) ->
5293 List<&2, Segment>:
5294 match elems:
5295 case Nil{}: Nil{}
5296 case Segment{+text, styles} <> tail:
5297 +ew = width(text)
5298 +fits = Nat.is_le((col + 1n + ew : Nat), w)
5299 plain(Bool.pick(String, fits, " ", "\n ")) <>
5300 Segment{text, styles} <> usage_rest(tail, w,
5301 Bool.pick(Nat, fits, (col + 1n + ew : Nat), (7n + ew : Nat)))