mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Add *args and **kwargs to _parse_known_args, and pass them through to the call to super(). _parse_known_args
This commit is contained in:
parent
f2e4c93785
commit
58ca7e77b7
1 changed files with 4 additions and 2 deletions
|
@ -354,7 +354,9 @@ class ArgParser(ap.ArgumentParser):
|
||||||
add_args(parser, func, allowed_params=args, doc=doc)
|
add_args(parser, func, allowed_params=args, doc=doc)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _parse_known_args(self, arg_strings: list[str], namespace: ap.Namespace):
|
def _parse_known_args(
|
||||||
|
self, arg_strings: list[str], namespace: ap.Namespace, *args, **kwargs
|
||||||
|
):
|
||||||
arg_set = set(arg_strings)
|
arg_set = set(arg_strings)
|
||||||
if (
|
if (
|
||||||
self.commands
|
self.commands
|
||||||
|
@ -363,7 +365,7 @@ class ArgParser(ap.ArgumentParser):
|
||||||
and (set(self.commands.choices).isdisjoint(arg_set))
|
and (set(self.commands.choices).isdisjoint(arg_set))
|
||||||
):
|
):
|
||||||
arg_strings = [self.default_command] + arg_strings
|
arg_strings = [self.default_command] + arg_strings
|
||||||
return super()._parse_known_args(arg_strings, namespace)
|
return super()._parse_known_args(arg_strings, namespace, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def run_with_partial_args(func: tp.Callable, ns: dict[str, tp.Any]):
|
def run_with_partial_args(func: tp.Callable, ns: dict[str, tp.Any]):
|
||||||
|
|
Loading…
Add table
Reference in a new issue