def tty_columns
import cli@0.2.0.0/cli.bend as Cliimport 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