summaryrefslogtreecommitdiff
path: root/lib/slop
diff options
context:
space:
mode:
Diffstat (limited to 'lib/slop')
-rw-r--r--lib/slop/parser.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/slop/parser.rb b/lib/slop/parser.rb
index 27e1c50..c6462ea 100644
--- a/lib/slop/parser.rb
+++ b/lib/slop/parser.rb
@@ -64,7 +64,7 @@ module Slop
if opt.expects_argument?
# if we consumed the argument, remove the next pair
- if orig_arg == opt.value.to_s
+ if consume_next_argument?(orig_flag)
pairs.delete_at(idx + 1)
end
@@ -106,6 +106,13 @@ module Slop
private
+ def consume_next_argument?(flag)
+ return false if flag.include?("=")
+ return true if flag.start_with?("--")
+ return true if /\A-[a-zA-Z]\z/ === flag
+ false
+ end
+
# We've found an option, process and return it
def process(option, arg)
option.ensure_call(arg)