[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

getopt/long and ARGV

Joel VanderWerf

11/12/2006 5:23:00 AM


Why does getopts delete the option _arguments_ but not the options
themselves from ARGV:

$ cat opt.rb
require "getopt/long"
include Getopt
opts = Long.getopts(
["--plot", BOOLEAN],
["--foo", OPTIONAL]
)
p ARGV

$ ruby opt.rb --plot --foo 8
["--plot", "--foo"]

Wouldn't it be better for #getopts to delete all members of ARGV that it
recognizes? Then you can use ARGF for the remaining file names.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407