* lib/getopts.rb: single_options can be nil[*], and is not not
optional. ([*]Pointed out by gotoken) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8b6ad9131e
commit
14461ddae6
@ -1,3 +1,8 @@
|
|||||||
|
Wed Mar 13 18:36:55 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* lib/getopts.rb: single_options can be nil[*], and is not not
|
||||||
|
optional. ([*]Pointed out by gotoken)
|
||||||
|
|
||||||
Tue Mar 12 17:12:06 2002 Tanaka Akira <akr@m17n.org>
|
Tue Mar 12 17:12:06 2002 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/resolv.rb: don't complete domains for absolute FQNs.
|
* lib/resolv.rb: don't complete domains for absolute FQNs.
|
||||||
|
11
doc/NEWS
11
doc/NEWS
@ -1,3 +1,14 @@
|
|||||||
|
: getopts.rb
|
||||||
|
|
||||||
|
Rewrote to fix some bugs and complete features.
|
||||||
|
- Accept options with the colon in the first argument;
|
||||||
|
getopts("a:bcd:") is equivalent to getopts("bc", "a:", "d:").
|
||||||
|
- Do not discard the argument that caused an error.
|
||||||
|
- Do not discard '-', which commonly stands for stdin or stdout.
|
||||||
|
- Allow specifying a long option with a value using '='.
|
||||||
|
(command --long-option=value)
|
||||||
|
- Stop reading options when it meets a non-option argument.
|
||||||
|
|
||||||
: tsort module
|
: tsort module
|
||||||
|
|
||||||
Imported. Topological sorting library.
|
Imported. Topological sorting library.
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
$RCS_ID=%q$Header$
|
$RCS_ID=%q$Header$
|
||||||
|
|
||||||
|
|
||||||
def getopts(single_options = '', *options)
|
def getopts(single_options, *options)
|
||||||
boolopts = {}
|
boolopts = {}
|
||||||
valopts = {}
|
valopts = {}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ def getopts(single_options = '', *options)
|
|||||||
else
|
else
|
||||||
valopts[opt[0, 1]] = nil
|
valopts[opt[0, 1]] = nil
|
||||||
end
|
end
|
||||||
end
|
end if single_options
|
||||||
|
|
||||||
options.each do |arg|
|
options.each do |arg|
|
||||||
opt, val = arg.split(':', 2)
|
opt, val = arg.split(':', 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user