From: Jim Freeze Date: 2005-06-28T12:39:23+09:00 Subject: Re: [ANN] Application-0.6.0 * Levin Alexander [2005-06-25 13:53:17 +0900]: > Jim Freeze wrote: > > Great! However, arguments with options do not seem to work correctly > > $ cat testapp.rb > #!/usr/bin/env ruby > require 'rubygems' > require 'commandline' > > # A minimum application > class App < CommandLine::Application > def initialize > option :debug, :arity => [1,1], > :opt_description => "Set debug level from 0 to 9" > > args :file1, :file2 Here, you are telling the app to expect two arguments. > super > end > end #class App > > $ ./testapp.rb --debug 2 file1 file2 This results in: @file1 #=> "2" @file2 #=> "file1" file2 #=> error Can you tell me how you expected the app to respond? > Exception `CommandLine::Application::ArgumentError' at > /usr/lib/ruby/gems/1.8/gems/CommandLine-0.6.0/lib/commandline/application.rb:87 > - Too many arguments. Found 3 but expected 2. > Usage: testapp.rb > ERROR: Too many arguments. Found 3 but expected 2. > Usage: testapp.rb -- Jim Freeze