From 901bd946f2a26fe1d786ec43b0771be4e0eeb9c5 Mon Sep 17 00:00:00 2001 From: Aleš Mrázek Date: Mon, 16 Dec 2024 18:14:15 +0100 Subject: python: client: handle the escape '--' argument better because we need it in completion --- python/knot_resolver/client/commands/completion.py | 2 ++ python/knot_resolver/client/commands/debug.py | 2 +- python/knot_resolver/client/main.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/knot_resolver/client/commands/completion.py b/python/knot_resolver/client/commands/completion.py index f3101c19..75f8e1eb 100644 --- a/python/knot_resolver/client/commands/completion.py +++ b/python/knot_resolver/client/commands/completion.py @@ -22,6 +22,8 @@ class CompletionCommand(Command): super().__init__(namespace) self.shell: Shells = namespace.shell self.args: List[str] = namespace.args + if namespace.extra is not None: + self.args.append("--") @staticmethod def register_args_subparser( diff --git a/python/knot_resolver/client/commands/debug.py b/python/knot_resolver/client/commands/debug.py index 00853c03..71ce673e 100644 --- a/python/knot_resolver/client/commands/debug.py +++ b/python/knot_resolver/client/commands/debug.py @@ -19,7 +19,7 @@ class DebugCommand(Command): self.sudo: bool = namespace.sudo self.gdb: str = namespace.gdb self.print_only: bool = namespace.print_only - self.gdb_args: List[str] = namespace.extra + self.gdb_args: List[str] = namespace.extra if namespace.extra is not None else [] super().__init__(namespace) @staticmethod diff --git a/python/knot_resolver/client/main.py b/python/knot_resolver/client/main.py index 461b7fc4..683bc95b 100644 --- a/python/knot_resolver/client/main.py +++ b/python/knot_resolver/client/main.py @@ -77,7 +77,7 @@ def main() -> None: argv_extra = sys.argv[(pa_index + 1) :] except ValueError: argv_to_parse = sys.argv[1:] - argv_extra = [] + argv_extra = None namespace = parser.parse_args(argv_to_parse) if hasattr(namespace, "extra"): -- cgit v1.2.3