Argument order error with getopt-declare

N

Nexos

Hi all,

I'm using getopt-declare and encounter an inexplicable problem in the
following code:

require 'Getopt/Declare'
$config = Hash.new
args = Getopt::Declare.new(%q§
[strict]

-d <delim> use <delim> as delimitor (single character)
{ reject(delim.length != 1, "delimitor must be a
single character")
$config[:delim] = delim }

-f force output file overwrite

-F <file:if>... process specified files
{ defer { file.each { |i|
puts "Filename = #{i}" } } }
§ )

If I use 'ruby myProg -F toto lulu', I get
Error: unrecognizable argument ('toto')
Error: unrecognizable argument ('lulu')

However, if I swap the -f and -F options, it oddly enough works as
expected.
Note I've used tabs to separate full argument specification from its
description.

Has someone any single clue on what has occured there ?

Thanks in advance,

Frédéric Delanoy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top