trollop 1.5 → 1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +3 -0
  2. data/lib/trollop.rb +12 -8
  3. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 1.6 / 2007-04-01
2
+ * Don't attempt curses screen-width magic unless running on a terminal.
3
+
1
4
  == 1.5 / 2007-03-31
2
5
  * --help and --version do the right thing even if the rest of the
3
6
  command line is incorrect.
data/lib/trollop.rb CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Trollop
7
7
 
8
- VERSION = "1.5"
8
+ VERSION = "1.6"
9
9
 
10
10
  ## Thrown by Parser in the event of a commandline error. Not needed if
11
11
  ## you're using the Trollop::options entry.
@@ -302,13 +302,17 @@ class Parser
302
302
 
303
303
  def width #:nodoc:
304
304
  @width ||=
305
- begin
306
- require 'curses'
307
- Curses::init_screen
308
- x = Curses::cols
309
- Curses::close_screen
310
- x
311
- rescue Exception
305
+ if $stdout.tty?
306
+ begin
307
+ require 'curses'
308
+ Curses::init_screen
309
+ x = Curses::cols
310
+ Curses::close_screen
311
+ x
312
+ rescue Exception
313
+ 80
314
+ end
315
+ else
312
316
  80
313
317
  end
314
318
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: trollop
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.5"
7
- date: 2007-03-31 00:00:00 -07:00
6
+ version: "1.6"
7
+ date: 2007-04-01 00:00:00 -07:00
8
8
  summary: Trollop is YAFCLAP --- yet another fine commandline argument processing library for Ruby. Trollop is designed to provide the maximal amount of GNU-style argument processing in the minimum number of lines of code (for you, the programmer).
9
9
  require_paths:
10
10
  - lib