Reliably get the terminal window size
In your mix.exs
:
defp deps do
[
{ :termsize, "~> 1.0.1" }
]
end
Then run mix deps.get
.
Make sure you add termsize
to your applications:
def application do
[applications: [:logger, :termsize]]
end
IO.puts TermSize.get # {151, 32}
{cols, rows} = TermSize.get
IO.puts cols # 151
IO.puts rows # 32
MIT © Juan Soto