From: Jim Weirich Date: 2003-01-20T23:50:07+09:00 Subject: Re: 2 optparse questions On Mon, 2003-01-20 at 09:34, Han Holl wrote: > Optparse is a quite powerful tool, but there are some issues: I tend to use the getoptlong library. It seems to address your issues. Here's an example ... require 'getoptlong' opts = GetoptLong.new ( ['--directory', '-d', GetoptLong::REQUIRED_ARGUMENT], ['--file', '-f', GetoptLong::OPTIONAL_ARGUMENT] ) opts.each do |opt, value| puts "#{opt}: #{value}" end Running this produces ... traken$ ruby opts.rb -ddir -d dir -ffile -f file --directory: dir --directory: dir --file: file --file: file -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)