How to get the width of terminal window in Ruby

前端 未结 9 1486
你的背包
你的背包 2021-01-30 16:30

Have you ever noticed that if you run rake -T in rails the list of rake descriptions are truncated by the width of the terminal window. So there should be a way to get it in Rub

9条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 17:01

    There is a common unix command:

    tput cols
    

    This returns the width of the terminal.

提交回复
热议问题