getopt-declare 1.26 → 1.27
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.txt +5 -0
- data/lib/Getopt/Declare.rb +17 -13
- metadata +2 -2
data/HISTORY.txt
CHANGED
data/lib/Getopt/Declare.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Ruby port of Perl's Getopt::Declare, version 1.21,
|
5
5
|
# released May 21, 1999.
|
6
6
|
#
|
7
|
-
# $Release Version: 1.
|
7
|
+
# $Release Version: 1.27 $
|
8
8
|
# $Date: 2007/01/15 10:53:09 $
|
9
9
|
# by Gonzalo Garramu�o
|
10
10
|
#
|
@@ -70,7 +70,7 @@ module Getopt
|
|
70
70
|
# Main Class
|
71
71
|
class Declare
|
72
72
|
|
73
|
-
VERSION = '1.
|
73
|
+
VERSION = '1.27'
|
74
74
|
|
75
75
|
# For debugging, use [debug] and it will output the ruby code as .CODE.rb
|
76
76
|
@@debug = false
|
@@ -616,7 +616,6 @@ EOS
|
|
616
616
|
end
|
617
617
|
end # while
|
618
618
|
|
619
|
-
|
620
619
|
@@helpcmdH.delete(@flag) if @@helpcmdH.key?(@flag)
|
621
620
|
@@versioncmdH.delete(@flag) if @@versioncmdH.key?(@flag)
|
622
621
|
end # initialize
|
@@ -635,12 +634,15 @@ EOS
|
|
635
634
|
i = 0
|
636
635
|
nocasei = ((Getopt::Declare::nocase || @nocase) ? 'i' : '')
|
637
636
|
|
638
|
-
code << " catch(:paramout) do\n"
|
639
|
-
|
640
|
-
|
637
|
+
code << " catch(:paramout) do\n while "
|
638
|
+
if @requires
|
639
|
+
code << requires << ' and '
|
640
|
+
end
|
641
|
+
code += !@repeatable? "!_FOUND_['" + self.foundid + "']" : "true"
|
642
|
+
|
641
643
|
if (flag && (clump==1 && flag !~ /\A[^a-z0-9]+[a-z0-9]\Z/i ||
|
642
644
|
(clump<3 && @args.size > 0 )))
|
643
|
-
code << '
|
645
|
+
code << ' and !_lastprefix'
|
644
646
|
end
|
645
647
|
|
646
648
|
code << '
|
@@ -1130,6 +1132,7 @@ EOS
|
|
1130
1132
|
end # while i.length
|
1131
1133
|
|
1132
1134
|
|
1135
|
+
|
1133
1136
|
_lastactions = nil
|
1134
1137
|
for i in _args
|
1135
1138
|
if _lastactions && i.ditto && i.actions.size == 0
|
@@ -1145,13 +1148,14 @@ EOS
|
|
1145
1148
|
|
1146
1149
|
# Sort flags based on criteria described in docs
|
1147
1150
|
# Sadly, this cannot be reduced to sort_by
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1151
|
+
_args = _args.sort() { |a,b|
|
1152
|
+
cond1 = ( b.flag.size <=> a.flag.size )
|
1153
|
+
cond2 = ( b.flag == a.flag and ( b.args.size <=> a.args.size ) )
|
1154
|
+
cond3 = ( a.id <=> b.id )
|
1155
|
+
cond1 = nil if cond1 == 0
|
1156
|
+
cond2 = nil if cond2 == 0
|
1157
|
+
cond1 or cond2 or cond3
|
1152
1158
|
}
|
1153
|
-
# _args = _args.sort_by { |a| [a.flag.size, a.flag, a.args.size, a.id] }
|
1154
|
-
|
1155
1159
|
|
1156
1160
|
# Handle clump
|
1157
1161
|
clump = (@usage =~ /\[\s*cluster:\s*none\s*\]/i) ? 0 :
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: getopt-declare
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date: 2007-06-
|
6
|
+
version: "1.27"
|
7
|
+
date: 2007-06-23 00:00:00 -03:00
|
8
8
|
summary: Getopt-Declare is a command-line argument parser.
|
9
9
|
require_paths:
|
10
10
|
- lib
|