diff options
author | konsolebox <[email protected]> | 2022-06-09 19:43:24 +0800 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-07-29 19:10:10 +0900 |
commit | 419ad1e13e6287d0b7a6ba1dfeb485d2f889bf9e (patch) | |
tree | 7d6140d0fb5f37e91a3330833ff5dadee6f7e6dc /lib/optparse.rb | |
parent | 3725454161b55681e5b4ec3b7ca23a4126e23736 (diff) |
[ruby/optparse] Also accept '-' as an optional argument (https://github.com/ruby/optparse/pull/35)
https://github.com/ruby/optparse/commit/f2b8318631
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6200
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r-- | lib/optparse.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index ec37bde3bd..1d42c79045 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -765,15 +765,15 @@ class OptionParser end # - # Switch that takes an argument, which does not begin with '-'. + # Switch that takes an argument, which does not begin with '-' or is '-'. # class PlacedArgument < self # - # Returns nil if argument is not present or begins with '-'. + # Returns nil if argument is not present or begins with '-' and is not '-'. # def parse(arg, argv, &error) - if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0])) + if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0])) return nil, block, nil end opt = (val = parse_arg(val, &error))[1] |