summaryrefslogtreecommitdiff
path: root/lib/getopts.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/getopts.rb')
-rw-r--r--lib/getopts.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/getopts.rb b/lib/getopts.rb
index b1cffd9ba0..34fb0d6442 100644
--- a/lib/getopts.rb
+++ b/lib/getopts.rb
@@ -105,11 +105,19 @@ def getopts(single_options, *options)
#
# set
#
+ $OPT = {}
+
boolopts.each do |opt, val|
- eval "$OPT_#{opt} = val"
+ $OPT[opt] = val
+
+ sopt = opt.gsub(/[^A-Za-z0-9_]/, '_')
+ eval "$OPT_#{sopt} = val"
end
valopts.each do |opt, val|
- eval "$OPT_#{opt} = val"
+ $OPT[opt] = val
+
+ sopt = opt.gsub(/[^A-Za-z0-9_]/, '_')
+ eval "$OPT_#{sopt} = val"
end
c