Skip to content

Commit

Permalink
Some more clarifications in pseudo_python_cli.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Oct 24, 2018
1 parent e9ce328 commit b6adf3b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions julia/pseudo_python_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def _add_argument_impl(self, name, alt, dest=None, nargs=None, action=None,
"Positional arguments are not supported."
" All positional arguments will be stored in `ns.args`.")
if terminal and action is not None:
raise NotImplementedError("Terminal option has to have argument.")
raise NotImplementedError(
"Terminal option is assumed to have argument."
" Non-`None` action={} is not supported".format())

if nargs is not None and action is not None:
raise TypeError("`nargs` and `action` are mutually exclusive")
Expand Down Expand Up @@ -194,7 +196,7 @@ def _parse_until_terminal(self, ns, args_iter):
if dest in seen:
self._usage_and_error(
"{} provided more than twice"
.format(" ".join(res.option.argdest.names)))
.format(", ".join(res.option.argdest.names)))
seen.add(dest)

while len(res.values) < res.option.nargs:
Expand All @@ -216,6 +218,13 @@ def _parse_until_terminal(self, ns, args_iter):
return

def _find_matches(self, arg):
"""
Return a list of `.Result`.
If value presents in `arg` (i.e., ``--long-option=value``), it
becomes the element of `.Result.values` (a list). Otherwise,
this list has to be filled by the caller (`_parse_until_terminal`).
"""
for opt in self._options:
if arg == opt.name:
return [Result(opt, [])]
Expand Down

0 comments on commit b6adf3b

Please sign in to comment.