On 6/11/2010 12:06 PM, Jos Backus wrote: > On Fri, Jun 11, 2010 at 03:25:06PM +0900, Robert Klemme wrote: > >> Drop your requirement. Think about it: what you require is extremely >> hard to do. How do you expect the option parsing to work reliably in >> light of ambiguity? If for example -e is also a valid option then what >> do you make of this? Since you likely also want to recognize -h you >> have the ambiguity built in right from the start. >> > > Well, while I agree with you, my colleagues will claim that Perl's > Getopt::Long pulls it off :) > > >> Alternatively, you could preprocess the arguments and look for "-help" >> yourself e.g. >> >> ARGV.map! {|arg| '-help' == arg ? '--help' : arg} >> > Yeah, but you'd have to do that for all the long option words. > > I wonder, is there an easy way to get the list of long option names from > optparse? If there was, you could do the above replacement only on those > elements of ARGV that are a long option, and keep bundled arguments such as > `-Dfoo=bar' working as it wouldn't match any of the long option names. > > Any ideas? > > Thanks, Robert! > > Maybe the getopt gem? Both are wrappers around the same C Library, so I would expect them to have the same functionality.