pb wrote:
> Jim Freeze wrote:
> 
>>> #!/usr/bin/env ruby
>>>
>>> require 'rubygems'
>>> require 'commandline'
>>>
>>> class App < CommandLine::Application
>>>   def initialize
>>          use_posix
> 
> A-HA!
> 
>>>       options :help, :debug
>>          option :posix, :flag, :names => "-d"
>>          option :posix, :flag, :names => "-v",
>>            :opt_found => lambda { puts "Version 1.0" }
>>> % ruby example.rb -dv
>> This should now work.
>> 
>> Jim
> 
> I shoulda grep'd a little harder!  Thanks Jim, I appreciate the effort
> you've put into these libraries.  Very useful.
> 
> pb

Oops, spoke too soon.  When I actually try this suggestion I get a
'unknown variable or method' error at the "use_posix" line.  The code
(minus use_posix) returns the original error: 'option -dv unknown'.

I understand the difference between POSIX & GNU option styles but
CommandLine's documentation states

"The Gnu and the Unix option types can be mixed on the same commandline. 
The following are equivalent:

  app -a -b --with-c
  app -ab --with-c
  app -ba --with-c
  app --with-c -ab"

I've yet to find a way to accomplish this claim within the example 
above.
Did I misunderstand the reply?  I know I'm doing something wrong since 
CommandLine is established code.  Where did I wander off the path?

pb

-- 
Posted via http://www.ruby-forum.com/.