From: Kenneth McDonald Date: 2008-09-26T10:11:07+09:00 Subject: Re: How to get terminal dimensions without using curses or ncurses? This looks very nice. Do you know where on OS X highline and its documentation get installed, after a sudo gem install? Strangely, I can't find them easing using the OS X search features. Thanks, Ken On Sep 25, 2008, at 7:27 PM, James Gray wrote: > On Sep 25, 2008, at 5:33 PM, Kenneth McDonald wrote: > >> I'd like to be able to print to terminal and do some reasonable >> formatting, without going to the trouble of learning curses. I >> simply need to know the dimensions of the terminal, but that info >> doesn't appear to be available in the ENV variables (which is what >> I'd expected.) Is there a way to get this info? > > Sure: > > $ cat term_size.rb > #!/usr/bin/env ruby -wKU > > require "rubygems" > require "highline/system_extensions" > > p HighLine::SystemExtensions.terminal_size > $ ruby term_size.rb > [80, 24] > > You can look in that file of the source if you just want to see how > HighLine is doing that on various platforms. > > James Edward Gray II >