@@ -133,7 +133,9 @@ def _add_argument_impl(self, name, alt, dest=None, nargs=None, action=None,
133133 "Positional arguments are not supported."
134134 " All positional arguments will be stored in `ns.args`." )
135135 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 ())
137139
138140 if nargs is not None and action is not None :
139141 raise TypeError ("`nargs` and `action` are mutually exclusive" )
@@ -194,7 +196,7 @@ def _parse_until_terminal(self, ns, args_iter):
194196 if dest in seen :
195197 self ._usage_and_error (
196198 "{} provided more than twice"
197- .format (" " .join (res .option .argdest .names )))
199+ .format (", " .join (res .option .argdest .names )))
198200 seen .add (dest )
199201
200202 while len (res .values ) < res .option .nargs :
@@ -216,6 +218,13 @@ def _parse_until_terminal(self, ns, args_iter):
216218 return
217219
218220 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+ """
219228 for opt in self ._options :
220229 if arg == opt .name :
221230 return [Result (opt , [])]
0 commit comments