"Robert Klemme" <bob.news / gmx.net> wrote in news:41fiouF1e6diiU1 / individual.net: > I used to use GetopLong in the beginning but switched to OptionParser. > Agreee, the documentation could be better but if you look carefully at > the example given in RDoc you get pretty much everything you need. > I'm not sure about a standard parser but my impression was that > OptionParser is more widely used. But I may be wrong here. I disagree about the example being all you need. Here's the first option in the example: # Mandatory argument. opts.on("-r", "--require LIBRARY", "Require the LIBRARY before executing your script") do |lib| options.library << lib end I am new to ruby, so I don't know what "options.library << lib" means. I thought that that introduced a here-doc string. The second example: # Optional argument; multi-line description. opts.on("-i", "--inplace [EXTENSION]", "Edit ARGV files in place", " (make backup if EXTENSION supplied)") do |ext| ... It took me a lot of staring at the code before it dawned on me that it was the *brackets* that made it an optional argument. The final example: # Another typical switch to print the version. opts.on_tail("--version", "Show version") do puts OptionParser::Version.join('.') exit end I can't figure out how the on_tail method differs from the on method or the on_head method. Reading the source isn't helping. The example sucks. The previous example has this comment: # No argument, shows at tail. This will print an options summary. "Shows at tail"?? At the end of the parse() method (and why is it self.parse, not just parse?), there is this: opts.parse!(args) I can't tell what function that performs for the class. I can't tell how to make an option mandatory, how to configure it so that some options require certain others or conflict with certain others. It looks like a fine, powerful module. But its lack of documentation makes it pretty much useless for anyone who doesn't already know how to use it. I come from the Perl world. You simply do not release a module to Perl's CPAN unless it is thoroughly documented. The vast majority of CPAN modules have quite good documentation -- or at least, thorough documentation. I'm quite surprised to find that the situation is so different in the ruby world. -- Eric `$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=( $!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++; $_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++ ;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`