@@ -133,7 +133,9 @@ def _add_argument_impl(self, name, alt, dest=None, nargs=None, action=None,
133
133
"Positional arguments are not supported."
134
134
" All positional arguments will be stored in `ns.args`." )
135
135
if terminal and action is not None :
136
- raise NotImplementedError ("Terminal option has to have argument." )
136
+ raise NotImplementedError (
137
+ "Terminal option is assumed to have argument."
138
+ " Non-`None` action={} is not supported" .format ())
137
139
138
140
if nargs is not None and action is not None :
139
141
raise TypeError ("`nargs` and `action` are mutually exclusive" )
@@ -194,7 +196,7 @@ def _parse_until_terminal(self, ns, args_iter):
194
196
if dest in seen :
195
197
self ._usage_and_error (
196
198
"{} provided more than twice"
197
- .format (" " .join (res .option .argdest .names )))
199
+ .format (", " .join (res .option .argdest .names )))
198
200
seen .add (dest )
199
201
200
202
while len (res .values ) < res .option .nargs :
@@ -216,6 +218,13 @@ def _parse_until_terminal(self, ns, args_iter):
216
218
return
217
219
218
220
def _find_matches (self , arg ):
221
+ """
222
+ Return a list of `.Result`.
223
+
224
+ If value presents in `arg` (i.e., ``--long-option=value``), it
225
+ becomes the element of `.Result.values` (a list). Otherwise,
226
+ this list has to be filled by the caller (`_parse_until_terminal`).
227
+ """
219
228
for opt in self ._options :
220
229
if arg == opt .name :
221
230
return [Result (opt , [])]
0 commit comments