handle when getTermCols returns 0
This commit is contained in:
parent
f58fa5218f
commit
da3cd404f3
1 changed files with 7 additions and 1 deletions
|
@ -40,6 +40,12 @@ record Options where
|
||||||
%name Options opts
|
%name Options opts
|
||||||
%runElab derive "Options" [Show]
|
%runElab derive "Options" [Show]
|
||||||
|
|
||||||
|
export
|
||||||
|
defaultWidth : IO Nat
|
||||||
|
defaultWidth = do
|
||||||
|
w <- cast {to = Nat} <$> getTermCols
|
||||||
|
pure $ if w == 0 then 80 else w
|
||||||
|
|
||||||
export
|
export
|
||||||
defaultOpts : IO Options
|
defaultOpts : IO Options
|
||||||
defaultOpts = pure $ MkOpts {
|
defaultOpts = pure $ MkOpts {
|
||||||
|
@ -47,7 +53,7 @@ defaultOpts = pure $ MkOpts {
|
||||||
outFile = Console,
|
outFile = Console,
|
||||||
until = Nothing,
|
until = Nothing,
|
||||||
flavor = Unicode,
|
flavor = Unicode,
|
||||||
width = cast !getTermCols,
|
width = !defaultWidth,
|
||||||
include = ["."]
|
include = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue