From be19a940268dbdbe00d3a4c885fd01d8692a79d2 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 10 Aug 2025 11:25:37 +0200 Subject: [PATCH] Fix command argument parser forgetting splittable last parts of last arg. --- ircplom/tui_base.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ircplom/tui_base.py b/ircplom/tui_base.py index 72a2247..3a9e0f4 100644 --- a/ircplom/tui_base.py +++ b/ircplom/tui_base.py @@ -476,15 +476,14 @@ class BaseTui(QueueMixin): if toks and not n_args_max: alert = f'{cmd_name} given argument(s) while none expected' else: - args: list[str] = [] - while toks and len(args) < n_args_max: - toks = toks[0].split(maxsplit=1) - args += [toks.pop(0)] - if len(args) < n_args_min: + if toks: + while ' ' in toks[-1] and len(toks) < n_args_max: + toks = toks[:-1] + toks[-1].split(maxsplit=1) + if len(toks) < n_args_min: alert = f'{cmd_name} too few arguments '\ - + f'(given {len(args)}, need {n_args_min})' + + f'(given {len(toks)}, need {n_args_min})' else: - alert = cmd(*args) + alert = cmd(*toks) else: alert = 'not prefixed by /' if alert: -- 2.30.2