On Tue, 14 Nov 2006, Stefano Crocco wrote:

> Thanks for the answers. I decided to take an approach similar to
> building my own parser, but keeping my two steps approach:
> - first:
>
>  ARGV.each_with_index do |s, i|
>    plugin=args[i+1] if s=='-p' or s=='--plugin' or s=~/-\w*p/
>  end
>
> (this should take care of the three possible formats: short option, long
> option and several short options together, such as -abp plugin
>
> - load the plugin
> - use OptionParser to rescan the options
>
> I'm still working on how to communicate the options recognized by the
> plugin to the main program.
>
> Stefano

OptionParser already handles unknown options:

   begin
     option_parser.parse! argv
   rescue OptionParser::InvalidOption => e
     # preverve unknown options
     e.recover argv
   end


-a
-- 
my religion is very simple.  my religion is kindness. -- the dalai lama