[Rake-devel] rake task descriptions and display width

James Tucker jftucker at gmail.com
Wed May 21 07:48:44 EDT 2008

Hi anyone/all,

Minor one, but it's been bugging me for a while. I want to see the  
full descriptions of rake tasks sometimes, or at least, a lot more of  
the description than 60 something chars. I had a look in rake.rb  
around the various things, spotted the fact that there is code for  
full descriptions, but that it's currently defaulted to false, I think  
all the time.

Anyway, more useful than this, to me at least, is to be able to use a  
known width of the screen where possible, so I added the following  
code starting at line 2012 of rake.rb. I would have provided a patch  
(and test cases), but I threw this together fast and dirty (inside the  
gem install), so the procedure would have been significantly longer.

The following code is useful under environments where the user has:
  * shopt -s checkwinsize (bash, or some other equivalent in other  
shells (sets COLUMNS and ROWS)).
  * export COLUMNS

It works as it previously did under conditions where the environment  
variable is not available.

Thanks for Rake, it's awesome,



         # if ENV['COLUMNS'] is nil, we want to supply 80 to  
Integer(), else we get 0 for nil.
         # if ENV['COLUMNS'] if for some reason 'foo', we need to  
rescue and return 80.
         display_cols = Integer(ENV['COLUMNS'] || 80) rescue 80
         max_column = display_cols - name.size - width - 7

More information about the Rake-devel mailing list