Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/alt/ruby32/share/ruby
File: getoptlong.rb
# frozen_string_literal: true
[0] Fix | Delete
#
[1] Fix | Delete
# GetoptLong for Ruby
[2] Fix | Delete
#
[3] Fix | Delete
# Copyright (C) 1998, 1999, 2000 Motoyuki Kasahara.
[4] Fix | Delete
#
[5] Fix | Delete
# You may redistribute and/or modify this library under the same license
[6] Fix | Delete
# terms as Ruby.
[7] Fix | Delete
[8] Fix | Delete
# \Class \GetoptLong provides parsing both for options
[9] Fix | Delete
# and for regular arguments.
[10] Fix | Delete
#
[11] Fix | Delete
# Using \GetoptLong, you can define options for your program.
[12] Fix | Delete
# The program can then capture and respond to whatever options
[13] Fix | Delete
# are included in the command that executes the program.
[14] Fix | Delete
#
[15] Fix | Delete
# A simple example: file <tt>simple.rb</tt>:
[16] Fix | Delete
#
[17] Fix | Delete
# :include: ../sample/getoptlong/simple.rb
[18] Fix | Delete
#
[19] Fix | Delete
# If you are somewhat familiar with options,
[20] Fix | Delete
# you may want to skip to this
[21] Fix | Delete
# {full example}[#class-GetoptLong-label-Full+Example].
[22] Fix | Delete
#
[23] Fix | Delete
# == Options
[24] Fix | Delete
#
[25] Fix | Delete
# A \GetoptLong option has:
[26] Fix | Delete
#
[27] Fix | Delete
# - A string <em>option name</em>.
[28] Fix | Delete
# - Zero or more string <em>aliases</em> for the name.
[29] Fix | Delete
# - An <em>option type</em>.
[30] Fix | Delete
#
[31] Fix | Delete
# Options may be defined by calling singleton method GetoptLong.new,
[32] Fix | Delete
# which returns a new \GetoptLong object.
[33] Fix | Delete
# Options may then be processed by calling other methods
[34] Fix | Delete
# such as GetoptLong#each.
[35] Fix | Delete
#
[36] Fix | Delete
# === Option Name and Aliases
[37] Fix | Delete
#
[38] Fix | Delete
# In the array that defines an option,
[39] Fix | Delete
# the first element is the string option name.
[40] Fix | Delete
# Often the name takes the 'long' form, beginning with two hyphens.
[41] Fix | Delete
#
[42] Fix | Delete
# The option name may have any number of aliases,
[43] Fix | Delete
# which are defined by additional string elements.
[44] Fix | Delete
#
[45] Fix | Delete
# The name and each alias must be of one of two forms:
[46] Fix | Delete
#
[47] Fix | Delete
# - Two hyphens, followed by one or more letters.
[48] Fix | Delete
# - One hyphen, followed by a single letter.
[49] Fix | Delete
#
[50] Fix | Delete
# File <tt>aliases.rb</tt>:
[51] Fix | Delete
#
[52] Fix | Delete
# :include: ../sample/getoptlong/aliases.rb
[53] Fix | Delete
#
[54] Fix | Delete
# An option may be cited by its name,
[55] Fix | Delete
# or by any of its aliases;
[56] Fix | Delete
# the parsed option always reports the name, not an alias:
[57] Fix | Delete
#
[58] Fix | Delete
# $ ruby aliases.rb -a -p --xxx --aaa -x
[59] Fix | Delete
#
[60] Fix | Delete
# Output:
[61] Fix | Delete
#
[62] Fix | Delete
# ["--xxx", ""]
[63] Fix | Delete
# ["--xxx", ""]
[64] Fix | Delete
# ["--xxx", ""]
[65] Fix | Delete
# ["--xxx", ""]
[66] Fix | Delete
# ["--xxx", ""]
[67] Fix | Delete
#
[68] Fix | Delete
#
[69] Fix | Delete
# An option may also be cited by an abbreviation of its name or any alias,
[70] Fix | Delete
# as long as that abbreviation is unique among the options.
[71] Fix | Delete
#
[72] Fix | Delete
# File <tt>abbrev.rb</tt>:
[73] Fix | Delete
#
[74] Fix | Delete
# :include: ../sample/getoptlong/abbrev.rb
[75] Fix | Delete
#
[76] Fix | Delete
# Command line:
[77] Fix | Delete
#
[78] Fix | Delete
# $ ruby abbrev.rb --xxx --xx --xyz --xy
[79] Fix | Delete
#
[80] Fix | Delete
# Output:
[81] Fix | Delete
#
[82] Fix | Delete
# ["--xxx", ""]
[83] Fix | Delete
# ["--xxx", ""]
[84] Fix | Delete
# ["--xyz", ""]
[85] Fix | Delete
# ["--xyz", ""]
[86] Fix | Delete
#
[87] Fix | Delete
# This command line raises GetoptLong::AmbiguousOption:
[88] Fix | Delete
#
[89] Fix | Delete
# $ ruby abbrev.rb --x
[90] Fix | Delete
#
[91] Fix | Delete
# === Repetition
[92] Fix | Delete
#
[93] Fix | Delete
# An option may be cited more than once:
[94] Fix | Delete
#
[95] Fix | Delete
# $ ruby abbrev.rb --xxx --xyz --xxx --xyz
[96] Fix | Delete
#
[97] Fix | Delete
# Output:
[98] Fix | Delete
#
[99] Fix | Delete
# ["--xxx", ""]
[100] Fix | Delete
# ["--xyz", ""]
[101] Fix | Delete
# ["--xxx", ""]
[102] Fix | Delete
# ["--xyz", ""]
[103] Fix | Delete
#
[104] Fix | Delete
# === Treating Remaining Options as Arguments
[105] Fix | Delete
#
[106] Fix | Delete
# A option-like token that appears
[107] Fix | Delete
# anywhere after the token <tt>--</tt> is treated as an ordinary argument,
[108] Fix | Delete
# and is not processed as an option:
[109] Fix | Delete
#
[110] Fix | Delete
# $ ruby abbrev.rb --xxx --xyz -- --xxx --xyz
[111] Fix | Delete
#
[112] Fix | Delete
# Output:
[113] Fix | Delete
#
[114] Fix | Delete
# ["--xxx", ""]
[115] Fix | Delete
# ["--xyz", ""]
[116] Fix | Delete
#
[117] Fix | Delete
# === Option Types
[118] Fix | Delete
#
[119] Fix | Delete
# Each option definition includes an option type,
[120] Fix | Delete
# which controls whether the option takes an argument.
[121] Fix | Delete
#
[122] Fix | Delete
# File <tt>types.rb</tt>:
[123] Fix | Delete
#
[124] Fix | Delete
# :include: ../sample/getoptlong/types.rb
[125] Fix | Delete
#
[126] Fix | Delete
# Note that an option type has to do with the <em>option argument</em>
[127] Fix | Delete
# (whether it is required, optional, or forbidden),
[128] Fix | Delete
# not with whether the option itself is required.
[129] Fix | Delete
#
[130] Fix | Delete
# ==== Option with Required Argument
[131] Fix | Delete
#
[132] Fix | Delete
# An option of type <tt>GetoptLong::REQUIRED_ARGUMENT</tt>
[133] Fix | Delete
# must be followed by an argument, which is associated with that option:
[134] Fix | Delete
#
[135] Fix | Delete
# $ ruby types.rb --xxx foo
[136] Fix | Delete
#
[137] Fix | Delete
# Output:
[138] Fix | Delete
#
[139] Fix | Delete
# ["--xxx", "foo"]
[140] Fix | Delete
#
[141] Fix | Delete
# If the option is not last, its argument is whatever follows it
[142] Fix | Delete
# (even if the argument looks like another option):
[143] Fix | Delete
#
[144] Fix | Delete
# $ ruby types.rb --xxx --yyy
[145] Fix | Delete
#
[146] Fix | Delete
# Output:
[147] Fix | Delete
#
[148] Fix | Delete
# ["--xxx", "--yyy"]
[149] Fix | Delete
#
[150] Fix | Delete
# If the option is last, an exception is raised:
[151] Fix | Delete
#
[152] Fix | Delete
# $ ruby types.rb
[153] Fix | Delete
# # Raises GetoptLong::MissingArgument
[154] Fix | Delete
#
[155] Fix | Delete
# ==== Option with Optional Argument
[156] Fix | Delete
#
[157] Fix | Delete
# An option of type <tt>GetoptLong::OPTIONAL_ARGUMENT</tt>
[158] Fix | Delete
# may be followed by an argument, which if given is associated with that option.
[159] Fix | Delete
#
[160] Fix | Delete
# If the option is last, it does not have an argument:
[161] Fix | Delete
#
[162] Fix | Delete
# $ ruby types.rb --yyy
[163] Fix | Delete
#
[164] Fix | Delete
# Output:
[165] Fix | Delete
#
[166] Fix | Delete
# ["--yyy", ""]
[167] Fix | Delete
#
[168] Fix | Delete
# If the option is followed by another option, it does not have an argument:
[169] Fix | Delete
#
[170] Fix | Delete
# $ ruby types.rb --yyy --zzz
[171] Fix | Delete
#
[172] Fix | Delete
# Output:
[173] Fix | Delete
#
[174] Fix | Delete
# ["--yyy", ""]
[175] Fix | Delete
# ["--zzz", ""]
[176] Fix | Delete
#
[177] Fix | Delete
# Otherwise the option is followed by its argument, which is associated
[178] Fix | Delete
# with that option:
[179] Fix | Delete
#
[180] Fix | Delete
# $ ruby types.rb --yyy foo
[181] Fix | Delete
#
[182] Fix | Delete
# Output:
[183] Fix | Delete
#
[184] Fix | Delete
# ["--yyy", "foo"]
[185] Fix | Delete
#
[186] Fix | Delete
# ==== Option with No Argument
[187] Fix | Delete
#
[188] Fix | Delete
# An option of type <tt>GetoptLong::NO_ARGUMENT</tt> takes no argument:
[189] Fix | Delete
#
[190] Fix | Delete
# ruby types.rb --zzz foo
[191] Fix | Delete
#
[192] Fix | Delete
# Output:
[193] Fix | Delete
#
[194] Fix | Delete
# ["--zzz", ""]
[195] Fix | Delete
#
[196] Fix | Delete
# === ARGV
[197] Fix | Delete
#
[198] Fix | Delete
# You can process options either with method #each and a block,
[199] Fix | Delete
# or with method #get.
[200] Fix | Delete
#
[201] Fix | Delete
# During processing, each found option is removed, along with its argument
[202] Fix | Delete
# if there is one.
[203] Fix | Delete
# After processing, each remaining element was neither an option
[204] Fix | Delete
# nor the argument for an option.
[205] Fix | Delete
#
[206] Fix | Delete
# File <tt>argv.rb</tt>:
[207] Fix | Delete
#
[208] Fix | Delete
# :include: ../sample/getoptlong/argv.rb
[209] Fix | Delete
#
[210] Fix | Delete
# Command line:
[211] Fix | Delete
#
[212] Fix | Delete
# $ ruby argv.rb --xxx Foo --yyy Bar Baz --zzz Bat Bam
[213] Fix | Delete
#
[214] Fix | Delete
# Output:
[215] Fix | Delete
#
[216] Fix | Delete
# Original ARGV: ["--xxx", "Foo", "--yyy", "Bar", "Baz", "--zzz", "Bat", "Bam"]
[217] Fix | Delete
# ["--xxx", "Foo"]
[218] Fix | Delete
# ["--yyy", "Bar"]
[219] Fix | Delete
# ["--zzz", ""]
[220] Fix | Delete
# Remaining ARGV: ["Baz", "Bat", "Bam"]
[221] Fix | Delete
#
[222] Fix | Delete
# === Ordering
[223] Fix | Delete
#
[224] Fix | Delete
# There are three settings that control the way the options
[225] Fix | Delete
# are interpreted:
[226] Fix | Delete
#
[227] Fix | Delete
# - +PERMUTE+.
[228] Fix | Delete
# - +REQUIRE_ORDER+.
[229] Fix | Delete
# - +RETURN_IN_ORDER+.
[230] Fix | Delete
#
[231] Fix | Delete
# The initial setting for a new \GetoptLong object is +REQUIRE_ORDER+
[232] Fix | Delete
# if environment variable +POSIXLY_CORRECT+ is defined, +PERMUTE+ otherwise.
[233] Fix | Delete
#
[234] Fix | Delete
# ==== PERMUTE Ordering
[235] Fix | Delete
#
[236] Fix | Delete
# In the +PERMUTE+ ordering, options and other, non-option,
[237] Fix | Delete
# arguments may appear in any order and any mixture.
[238] Fix | Delete
#
[239] Fix | Delete
# File <tt>permute.rb</tt>:
[240] Fix | Delete
#
[241] Fix | Delete
# :include: ../sample/getoptlong/permute.rb
[242] Fix | Delete
#
[243] Fix | Delete
# Command line:
[244] Fix | Delete
#
[245] Fix | Delete
# $ ruby permute.rb Foo --zzz Bar --xxx Baz --yyy Bat Bam --xxx Bag Bah
[246] Fix | Delete
#
[247] Fix | Delete
# Output:
[248] Fix | Delete
#
[249] Fix | Delete
# Original ARGV: ["Foo", "--zzz", "Bar", "--xxx", "Baz", "--yyy", "Bat", "Bam", "--xxx", "Bag", "Bah"]
[250] Fix | Delete
# ["--zzz", ""]
[251] Fix | Delete
# ["--xxx", "Baz"]
[252] Fix | Delete
# ["--yyy", "Bat"]
[253] Fix | Delete
# ["--xxx", "Bag"]
[254] Fix | Delete
# Remaining ARGV: ["Foo", "Bar", "Bam", "Bah"]
[255] Fix | Delete
#
[256] Fix | Delete
# ==== REQUIRE_ORDER Ordering
[257] Fix | Delete
#
[258] Fix | Delete
# In the +REQUIRE_ORDER+ ordering, all options precede all non-options;
[259] Fix | Delete
# that is, each word after the first non-option word
[260] Fix | Delete
# is treated as a non-option word (even if it begins with a hyphen).
[261] Fix | Delete
#
[262] Fix | Delete
# File <tt>require_order.rb</tt>:
[263] Fix | Delete
#
[264] Fix | Delete
# :include: ../sample/getoptlong/require_order.rb
[265] Fix | Delete
#
[266] Fix | Delete
# Command line:
[267] Fix | Delete
#
[268] Fix | Delete
# $ ruby require_order.rb --xxx Foo Bar --xxx Baz --yyy Bat -zzz
[269] Fix | Delete
#
[270] Fix | Delete
# Output:
[271] Fix | Delete
#
[272] Fix | Delete
# Original ARGV: ["--xxx", "Foo", "Bar", "--xxx", "Baz", "--yyy", "Bat", "-zzz"]
[273] Fix | Delete
# ["--xxx", "Foo"]
[274] Fix | Delete
# Remaining ARGV: ["Bar", "--xxx", "Baz", "--yyy", "Bat", "-zzz"]
[275] Fix | Delete
#
[276] Fix | Delete
# ==== RETURN_IN_ORDER Ordering
[277] Fix | Delete
#
[278] Fix | Delete
# In the +RETURN_IN_ORDER+ ordering, every word is treated as an option.
[279] Fix | Delete
# A word that begins with a hyphen (or two) is treated in the usual way;
[280] Fix | Delete
# a word +word+ that does not so begin is treated as an option
[281] Fix | Delete
# whose name is an empty string, and whose value is +word+.
[282] Fix | Delete
#
[283] Fix | Delete
# File <tt>return_in_order.rb</tt>:
[284] Fix | Delete
#
[285] Fix | Delete
# :include: ../sample/getoptlong/return_in_order.rb
[286] Fix | Delete
#
[287] Fix | Delete
# Command line:
[288] Fix | Delete
#
[289] Fix | Delete
# $ ruby return_in_order.rb Foo --xxx Bar Baz --zzz Bat Bam
[290] Fix | Delete
#
[291] Fix | Delete
# Output:
[292] Fix | Delete
#
[293] Fix | Delete
# Original ARGV: ["Foo", "--xxx", "Bar", "Baz", "--zzz", "Bat", "Bam"]
[294] Fix | Delete
# ["", "Foo"]
[295] Fix | Delete
# ["--xxx", "Bar"]
[296] Fix | Delete
# ["", "Baz"]
[297] Fix | Delete
# ["--zzz", ""]
[298] Fix | Delete
# ["", "Bat"]
[299] Fix | Delete
# ["", "Bam"]
[300] Fix | Delete
# Remaining ARGV: []
[301] Fix | Delete
#
[302] Fix | Delete
# === Full Example
[303] Fix | Delete
#
[304] Fix | Delete
# File <tt>fibonacci.rb</tt>:
[305] Fix | Delete
#
[306] Fix | Delete
# :include: ../sample/getoptlong/fibonacci.rb
[307] Fix | Delete
#
[308] Fix | Delete
# Command line:
[309] Fix | Delete
#
[310] Fix | Delete
# $ ruby fibonacci.rb
[311] Fix | Delete
#
[312] Fix | Delete
# Output:
[313] Fix | Delete
#
[314] Fix | Delete
# Option --number is required.
[315] Fix | Delete
# Usage:
[316] Fix | Delete
#
[317] Fix | Delete
# -n n, --number n:
[318] Fix | Delete
# Compute Fibonacci number for n.
[319] Fix | Delete
# -v [boolean], --verbose [boolean]:
[320] Fix | Delete
# Show intermediate results; default is 'false'.
[321] Fix | Delete
# -h, --help:
[322] Fix | Delete
# Show this help.
[323] Fix | Delete
#
[324] Fix | Delete
# Command line:
[325] Fix | Delete
#
[326] Fix | Delete
# $ ruby fibonacci.rb --number
[327] Fix | Delete
#
[328] Fix | Delete
# Raises GetoptLong::MissingArgument:
[329] Fix | Delete
#
[330] Fix | Delete
# fibonacci.rb: option `--number' requires an argument
[331] Fix | Delete
#
[332] Fix | Delete
# Command line:
[333] Fix | Delete
#
[334] Fix | Delete
# $ ruby fibonacci.rb --number 6
[335] Fix | Delete
#
[336] Fix | Delete
# Output:
[337] Fix | Delete
#
[338] Fix | Delete
# 8
[339] Fix | Delete
#
[340] Fix | Delete
# Command line:
[341] Fix | Delete
#
[342] Fix | Delete
# $ ruby fibonacci.rb --number 6 --verbose
[343] Fix | Delete
#
[344] Fix | Delete
# Output:
[345] Fix | Delete
# 1
[346] Fix | Delete
# 2
[347] Fix | Delete
# 3
[348] Fix | Delete
# 5
[349] Fix | Delete
# 8
[350] Fix | Delete
#
[351] Fix | Delete
# Command line:
[352] Fix | Delete
#
[353] Fix | Delete
# $ ruby fibonacci.rb --number 6 --verbose yes
[354] Fix | Delete
#
[355] Fix | Delete
# Output:
[356] Fix | Delete
#
[357] Fix | Delete
# --verbose argument must be true or false
[358] Fix | Delete
# Usage:
[359] Fix | Delete
#
[360] Fix | Delete
# -n n, --number n:
[361] Fix | Delete
# Compute Fibonacci number for n.
[362] Fix | Delete
# -v [boolean], --verbose [boolean]:
[363] Fix | Delete
# Show intermediate results; default is 'false'.
[364] Fix | Delete
# -h, --help:
[365] Fix | Delete
# Show this help.
[366] Fix | Delete
#
[367] Fix | Delete
class GetoptLong
[368] Fix | Delete
# Version.
[369] Fix | Delete
VERSION = "0.2.0"
[370] Fix | Delete
[371] Fix | Delete
#
[372] Fix | Delete
# Orderings.
[373] Fix | Delete
#
[374] Fix | Delete
ORDERINGS = [REQUIRE_ORDER = 0, PERMUTE = 1, RETURN_IN_ORDER = 2]
[375] Fix | Delete
[376] Fix | Delete
#
[377] Fix | Delete
# Argument flags.
[378] Fix | Delete
#
[379] Fix | Delete
ARGUMENT_FLAGS = [NO_ARGUMENT = 0, REQUIRED_ARGUMENT = 1,
[380] Fix | Delete
OPTIONAL_ARGUMENT = 2]
[381] Fix | Delete
[382] Fix | Delete
#
[383] Fix | Delete
# Status codes.
[384] Fix | Delete
#
[385] Fix | Delete
STATUS_YET, STATUS_STARTED, STATUS_TERMINATED = 0, 1, 2
[386] Fix | Delete
[387] Fix | Delete
#
[388] Fix | Delete
# Error types.
[389] Fix | Delete
#
[390] Fix | Delete
class Error < StandardError; end
[391] Fix | Delete
class AmbiguousOption < Error; end
[392] Fix | Delete
class NeedlessArgument < Error; end
[393] Fix | Delete
class MissingArgument < Error; end
[394] Fix | Delete
class InvalidOption < Error; end
[395] Fix | Delete
[396] Fix | Delete
#
[397] Fix | Delete
# Returns a new \GetoptLong object based on the given +arguments+.
[398] Fix | Delete
# See {Options}[#class-GetoptLong-label-Options].
[399] Fix | Delete
#
[400] Fix | Delete
# Example:
[401] Fix | Delete
#
[402] Fix | Delete
# :include: ../sample/getoptlong/simple.rb
[403] Fix | Delete
#
[404] Fix | Delete
# Raises an exception if:
[405] Fix | Delete
#
[406] Fix | Delete
# - Any of +arguments+ is not an array.
[407] Fix | Delete
# - Any option name or alias is not a string.
[408] Fix | Delete
# - Any option type is invalid.
[409] Fix | Delete
#
[410] Fix | Delete
def initialize(*arguments)
[411] Fix | Delete
#
[412] Fix | Delete
# Current ordering.
[413] Fix | Delete
#
[414] Fix | Delete
if ENV.include?('POSIXLY_CORRECT')
[415] Fix | Delete
@ordering = REQUIRE_ORDER
[416] Fix | Delete
else
[417] Fix | Delete
@ordering = PERMUTE
[418] Fix | Delete
end
[419] Fix | Delete
[420] Fix | Delete
#
[421] Fix | Delete
# Hash table of option names.
[422] Fix | Delete
# Keys of the table are option names, and their values are canonical
[423] Fix | Delete
# names of the options.
[424] Fix | Delete
#
[425] Fix | Delete
@canonical_names = Hash.new
[426] Fix | Delete
[427] Fix | Delete
#
[428] Fix | Delete
# Hash table of argument flags.
[429] Fix | Delete
# Keys of the table are option names, and their values are argument
[430] Fix | Delete
# flags of the options.
[431] Fix | Delete
#
[432] Fix | Delete
@argument_flags = Hash.new
[433] Fix | Delete
[434] Fix | Delete
#
[435] Fix | Delete
# Whether error messages are output to $stderr.
[436] Fix | Delete
#
[437] Fix | Delete
@quiet = false
[438] Fix | Delete
[439] Fix | Delete
#
[440] Fix | Delete
# Status code.
[441] Fix | Delete
#
[442] Fix | Delete
@status = STATUS_YET
[443] Fix | Delete
[444] Fix | Delete
#
[445] Fix | Delete
# Error code.
[446] Fix | Delete
#
[447] Fix | Delete
@error = nil
[448] Fix | Delete
[449] Fix | Delete
#
[450] Fix | Delete
# Error message.
[451] Fix | Delete
#
[452] Fix | Delete
@error_message = nil
[453] Fix | Delete
[454] Fix | Delete
#
[455] Fix | Delete
# Rest of catenated short options.
[456] Fix | Delete
#
[457] Fix | Delete
@rest_singles = ''
[458] Fix | Delete
[459] Fix | Delete
#
[460] Fix | Delete
# List of non-option-arguments.
[461] Fix | Delete
# Append them to ARGV when option processing is terminated.
[462] Fix | Delete
#
[463] Fix | Delete
@non_option_arguments = Array.new
[464] Fix | Delete
[465] Fix | Delete
if 0 < arguments.length
[466] Fix | Delete
set_options(*arguments)
[467] Fix | Delete
end
[468] Fix | Delete
end
[469] Fix | Delete
[470] Fix | Delete
# Sets the ordering; see {Ordering}[#class-GetoptLong-label-Ordering];
[471] Fix | Delete
# returns the new ordering.
[472] Fix | Delete
#
[473] Fix | Delete
# If the given +ordering+ is +PERMUTE+ and environment variable
[474] Fix | Delete
# +POSIXLY_CORRECT+ is defined, sets the ordering to +REQUIRE_ORDER+;
[475] Fix | Delete
# otherwise sets the ordering to +ordering+:
[476] Fix | Delete
#
[477] Fix | Delete
# options = GetoptLong.new
[478] Fix | Delete
# options.ordering == GetoptLong::PERMUTE # => true
[479] Fix | Delete
# options.ordering = GetoptLong::RETURN_IN_ORDER
[480] Fix | Delete
# options.ordering == GetoptLong::RETURN_IN_ORDER # => true
[481] Fix | Delete
# ENV['POSIXLY_CORRECT'] = 'true'
[482] Fix | Delete
# options.ordering = GetoptLong::PERMUTE
[483] Fix | Delete
# options.ordering == GetoptLong::REQUIRE_ORDER # => true
[484] Fix | Delete
#
[485] Fix | Delete
# Raises an exception if +ordering+ is invalid.
[486] Fix | Delete
#
[487] Fix | Delete
def ordering=(ordering)
[488] Fix | Delete
#
[489] Fix | Delete
# The method is failed if option processing has already started.
[490] Fix | Delete
#
[491] Fix | Delete
if @status != STATUS_YET
[492] Fix | Delete
set_error(ArgumentError, "argument error")
[493] Fix | Delete
raise RuntimeError,
[494] Fix | Delete
"invoke ordering=, but option processing has already started"
[495] Fix | Delete
end
[496] Fix | Delete
[497] Fix | Delete
#
[498] Fix | Delete
# Check ordering.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function