diff options
author | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-12-16 18:14:15 +0100 |
---|---|---|
committer | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-12-20 22:24:22 +0100 |
commit | 901bd946f2a26fe1d786ec43b0771be4e0eeb9c5 (patch) | |
tree | e2a8fc8f3fca24b616257998d642a63beaada1c6 | |
parent | python: client: command: move the getting of completion words to function (diff) | |
download | knot-resolver-901bd946f2a26fe1d786ec43b0771be4e0eeb9c5.tar.xz knot-resolver-901bd946f2a26fe1d786ec43b0771be4e0eeb9c5.zip |
python: client: handle the escape '--' argument better because we need it in completion
-rw-r--r-- | python/knot_resolver/client/commands/completion.py | 2 | ||||
-rw-r--r-- | python/knot_resolver/client/commands/debug.py | 2 | ||||
-rw-r--r-- | 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"): |