From 0be539a40a7103da07334db9a13ac5c3418944f5 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 14 Aug 2026 23:53:23 +0200 Subject: [PATCH] lib.App: Use parser in _add_arguments() _add_arguments() adds the global options to self.__parser instead of to the parser it receives. The two are the same object, because the only caller passes self.__parser, so the change is not observable. Use the parser parameter instead, so that the method honors its argument the way Cmd.add_arguments() does, and so that the global options can be shared with other parsers, e.g. the subcommand parsers, without rewriting this method. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2 Signed-off-by: Jan Lindemann --- src/python/jw/pkg/lib/App.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/python/jw/pkg/lib/App.py b/src/python/jw/pkg/lib/App.py index 276816b2..2df96c67 100644 --- a/src/python/jw/pkg/lib/App.py +++ b/src/python/jw/pkg/lib/App.py @@ -46,28 +46,28 @@ def _get_current_event_loop() -> asyncio.AbstractEventLoop | None: class App: # export def _add_arguments(self, parser: ArgumentParser) -> None: - self.__parser.add_argument( + parser.add_argument( '--log-flags', help = 'Log flags', default = self.__default_log_flags, type = parse_log_flags, ) - self.__parser.add_argument( + parser.add_argument( '--log-level', help = 'Log level', default = self.__default_log_level, type = parse_log_level, ) - self.__parser.add_argument( + parser.add_argument( '--log-file', help = 'Log file', default = self.__default_log_file ) - self.__parser.add_argument( + parser.add_argument( '--backtrace', help = 'Show exception backtraces', action = 'store_true', default = self.__back_trace, ) - self.__parser.add_argument( + parser.add_argument( '--write-profile', help = 'Profile code and store output to file', default = None,