Project

General

Profile

Feature #8460 » 0002-Move-dash-dash-handling-to-a-case.patch

Move dash dash handling to a case - felipec (Felipe Contreras), 04/02/2023 06:50 AM

View differences:

lib/optparse.rb
ArgumentStyle.freeze
#
# Switches common used such as '--', and also provides default
# argument classes
# Provides default argument classes
#
DefaultList = List.new
DefaultList.short['-'] = Switch::NoArgument.new {}
DefaultList.long[''] = Switch::NoArgument.new {throw :terminate}
COMPSYS_HEADER = <<'XXX' # :nodoc:
......
argv.unshift(arg) if arg = catch(:terminate) {
while arg = argv.shift
case arg
# dash dash
when /\A--\Z/m
break
# long option
when /\A--([^=]*)(?:=(.*))?/m
when /\A--([^=]+)(?:=(.*))?/m
opt, rest = $1, $2
opt.tr!('_', '-')
begin
(2-2/3)