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 <jan@janware.com>
This commit is contained in:
parent
f706477f18
commit
0be539a40a
1 changed files with 5 additions and 5 deletions
|
|
@ -46,28 +46,28 @@ def _get_current_event_loop() -> asyncio.AbstractEventLoop | None:
|
||||||
class App: # export
|
class App: # export
|
||||||
|
|
||||||
def _add_arguments(self, parser: ArgumentParser) -> None:
|
def _add_arguments(self, parser: ArgumentParser) -> None:
|
||||||
self.__parser.add_argument(
|
parser.add_argument(
|
||||||
'--log-flags',
|
'--log-flags',
|
||||||
help = 'Log flags',
|
help = 'Log flags',
|
||||||
default = self.__default_log_flags,
|
default = self.__default_log_flags,
|
||||||
type = parse_log_flags,
|
type = parse_log_flags,
|
||||||
)
|
)
|
||||||
self.__parser.add_argument(
|
parser.add_argument(
|
||||||
'--log-level',
|
'--log-level',
|
||||||
help = 'Log level',
|
help = 'Log level',
|
||||||
default = self.__default_log_level,
|
default = self.__default_log_level,
|
||||||
type = parse_log_level,
|
type = parse_log_level,
|
||||||
)
|
)
|
||||||
self.__parser.add_argument(
|
parser.add_argument(
|
||||||
'--log-file', help = 'Log file', default = self.__default_log_file
|
'--log-file', help = 'Log file', default = self.__default_log_file
|
||||||
)
|
)
|
||||||
self.__parser.add_argument(
|
parser.add_argument(
|
||||||
'--backtrace',
|
'--backtrace',
|
||||||
help = 'Show exception backtraces',
|
help = 'Show exception backtraces',
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
default = self.__back_trace,
|
default = self.__back_trace,
|
||||||
)
|
)
|
||||||
self.__parser.add_argument(
|
parser.add_argument(
|
||||||
'--write-profile',
|
'--write-profile',
|
||||||
help = 'Profile code and store output to file',
|
help = 'Profile code and store output to file',
|
||||||
default = None,
|
default = None,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue