optopus 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/optopus.rb +26 -18
- metadata +3 -3
data/lib/optopus.rb
CHANGED
@@ -63,38 +63,46 @@ module Optopus
|
|
63
63
|
(class<<self; self; end).send(:define_method, :evaluate, &block)
|
64
64
|
end
|
65
65
|
|
66
|
-
def parse_error(reason)
|
67
|
-
|
66
|
+
def parse_error(reason, *args)
|
67
|
+
args = @args if args.empty?
|
68
|
+
e = OptionParser::ParseError.new(*args)
|
68
69
|
e.reason = reason
|
69
70
|
raise e
|
70
71
|
end
|
71
72
|
|
72
|
-
def ambiguous_option
|
73
|
-
|
73
|
+
def ambiguous_option(*args)
|
74
|
+
args = @args if args.empty?
|
75
|
+
raise OptionParser::AmbiguousOption.new(*args)
|
74
76
|
end
|
75
77
|
|
76
|
-
def needless_argument
|
77
|
-
|
78
|
+
def needless_argument(*args)
|
79
|
+
args = @args if args.empty?
|
80
|
+
raise OptionParser::NeedlessArgument.new(*args)
|
78
81
|
end
|
79
82
|
|
80
|
-
def missing_argument
|
81
|
-
|
83
|
+
def missing_argument(*args)
|
84
|
+
args = @args if args.empty?
|
85
|
+
raise OptionParser::MissingArgument.new(*args)
|
82
86
|
end
|
83
87
|
|
84
|
-
def invalid_option
|
85
|
-
|
88
|
+
def invalid_option(*args)
|
89
|
+
args = @args if args.empty?
|
90
|
+
raise OptionParser::InvalidOption.new(*args)
|
86
91
|
end
|
87
92
|
|
88
|
-
def invalid_argument
|
89
|
-
|
93
|
+
def invalid_argument(*args)
|
94
|
+
args = @args if args.empty?
|
95
|
+
raise OptionParser::InvalidArgument.new(*args)
|
90
96
|
end
|
91
97
|
|
92
|
-
def ambiguous_argument
|
93
|
-
|
98
|
+
def ambiguous_argument(*args)
|
99
|
+
args = @args if args.empty?
|
100
|
+
raise OptionParser::AmbiguousArgument.new(*args)
|
94
101
|
end
|
95
102
|
|
96
|
-
def not_given
|
97
|
-
|
103
|
+
def not_given(*args)
|
104
|
+
args = @args if args.empty?
|
105
|
+
raise OptionParser::NotGiven.new(*args)
|
98
106
|
end
|
99
107
|
end # CheckerContext
|
100
108
|
|
@@ -162,11 +170,11 @@ module Optopus
|
|
162
170
|
end
|
163
171
|
|
164
172
|
value = conv.call(value) if conv
|
165
|
-
|
173
|
+
|
166
174
|
options[name] = value
|
167
175
|
end
|
168
176
|
end
|
169
|
-
end
|
177
|
+
end # if @file_args
|
170
178
|
|
171
179
|
@opts_args.each do |name, args, defval, block, required, multiple|
|
172
180
|
options[name] = defval unless defval.nil?
|
metadata
CHANGED