def each_arg(args)
			remains = []
			i = 0

			until i >= args.length
				return remains += args[i..-1] if @stop_words.member? args[i]
				case args[i]
				when /^--$/ # arg terminator
					return remains += args[(i + 1)..-1]
				when /^--(\S+?)=(.*)$/ # long argument with equals
					num_params_taken = yield "--#{$1}", [$2]
					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					end
					i += 1
				when /^--(\S+)$/ # long argument
					params = collect_argument_parameters(args, i + 1)
					num_params_taken = yield args[i], params

					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					else
						i += num_params_taken
					end
					i += 1
				when /^-(\S+)$/ # one or more short arguments
					short_remaining = ""
					shortargs = $1.split(//)
					shortargs.each_with_index do |a, j|
						if j == (shortargs.length - 1)
							params = collect_argument_parameters(args, i + 1)

							num_params_taken = yield "-#{a}", params
							unless num_params_taken
								short_remaining << a
								if @stop_on_unknown
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							else
								i += num_params_taken
							end
						else
							unless yield "-#{a}", []
								short_remaining << a
								if @stop_on_unknown
									short_remaining += shortargs[j + 1..-1].join
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							end
						end
					end

					unless short_remaining.empty?
						remains << "-#{short_remaining}"
					end
					i += 1
				else
					if @stop_on_unknown
						return remains += args[i..-1]
					else
						remains << args[i]
						i += 1
					end
				end
			end

			remains
		end
def each_arg(args)
			remains = []
			i = 0

			until i >= args.length
				return remains += args[i..-1] if @stop_words.member? args[i]
				case args[i]
				when /^--$/ # arg terminator
					return remains += args[(i + 1)..-1]
				when /^--(\S+?)=(.*)$/ # long argument with equals
					num_params_taken = yield "--#{$1}", [$2]
					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					end
					i += 1
				when /^--(\S+)$/ # long argument
					params = collect_argument_parameters(args, i + 1)
					num_params_taken = yield args[i], params

					if num_params_taken.nil?
						remains << args[i]
						if @stop_on_unknown
							return remains += args[i + 1..-1]
						end
					else
						i += num_params_taken
					end
					i += 1
				when /^-(\S+)$/ # one or more short arguments
					short_remaining = ""
					shortargs = $1.split(//)
					shortargs.each_with_index do |a, j|
						if j == (shortargs.length - 1)
							params = collect_argument_parameters(args, i + 1)

							num_params_taken = yield "-#{a}", params
							unless num_params_taken
								short_remaining << a
								if @stop_on_unknown
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							else
								i += num_params_taken
							end
						else
							unless yield "-#{a}", []
								short_remaining << a
								if @stop_on_unknown
									short_remaining += shortargs[j + 1..-1].join
									remains << "-#{short_remaining}"
									return remains += args[i + 1..-1]
								end
							end
						end
					end

					unless short_remaining.empty?
						remains << "-#{short_remaining}"
					end
					i += 1
				else
					if @stop_on_unknown
						return remains += args[i..-1]
					else
						remains << args[i]
						i += 1
					end
				end
			end

			remains
		end
yield successive arg, parameter pairs