def tty_columns

cli@0.2.0.0 · cli.bend:7821

import cli@0.2.0.0/cli.bend as Cli
import Base

7821# stdout's columns if it is a TTY, else stderr's if it is one, else 0.
7822def tty_columns(out_tty: Bool, err_tty: Bool, out_cols: U32,
7823    err_cols: U32) -> Nat:
7824  match out_tty err_tty:
7825    case True{} _: U32.to_nat(out_cols)
7826    case False{} True{}: U32.to_nat(err_cols)
7827    case False{} False{}: 0n

Uses (4)

Used by (1)