From 3faceb97dd829698c920c92637f53955fa5c46bf Mon Sep 17 00:00:00 2001 From: Renato Silva Date: Sun, 3 Aug 2014 08:24:34 -0300 Subject: [PATCH] Fix next option mistook for value of current option in Ruby version. For example, if --foo requires a value and --foo --bar is specified in command line, then --bar would be mistakenly recognized as the value for --foo. Now a proper error is raised requiring a value for --foo. --- easyoptions.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easyoptions.rb b/easyoptions.rb index 17e0dd9..af50e88 100644 --- a/easyoptions.rb +++ b/easyoptions.rb @@ -2,7 +2,7 @@ # Encoding: ISO-8859-1 ## -## EasyOptions 2014.7.23 +## EasyOptions 2014.8.3 ## Copyright (c) 2013, 2014 Renato Silva ## GNU GPLv2 licensed ## @@ -168,7 +168,7 @@ arguments.each_with_index do |argument, index| # Option with value in next parameter elsif known_option.in?(argument) and not known_option.boolean then value = arguments[index + 1] - finish("you must specify a value for #{known_option}") if not value + finish("you must specify a value for #{known_option}") if not value or value.start_with?("-") value = value.to_i if value =~ /^[0-9]+$/ $options[known_option.long] = value unknown_option = false