From 38de31f1e278a9291a2edd9e99b89c8dc6a7e286 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 30 Oct 2021 17:27:05 -0700 Subject: [PATCH] Let the wrapped mains take additional arguments. Just in case the application wants to do so. --- voussoirkit/operatornotify.py | 6 +++--- voussoirkit/vlogging.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/voussoirkit/operatornotify.py b/voussoirkit/operatornotify.py index 172a969..d34c0d4 100644 --- a/voussoirkit/operatornotify.py +++ b/voussoirkit/operatornotify.py @@ -239,14 +239,14 @@ def main_decorator(subject, *, log_return_value=True, **kwargs): 3. Wrap main call with main_log_context. ''' def wrapper(main): - def wrapped(argv): + def wrapped(argv, *args, **kwargs): (argv, level) = get_level_by_argv(argv) if level is None: - return main(argv) + return main(argv, *args, **kwargs) context = main_log_context(subject, level, **kwargs) with context: - status = main(argv) + status = main(argv, *args, **kwargs) if log_return_value: log.info('Program finished, returned %s.', status) return status diff --git a/voussoirkit/vlogging.py b/voussoirkit/vlogging.py index 3509fe3..cd0a588 100644 --- a/voussoirkit/vlogging.py +++ b/voussoirkit/vlogging.py @@ -182,8 +182,8 @@ def main_decorator(main): to use --debug, --quiet, etc. on the command line without making any changes to your argparser. ''' - def wrapped(argv): + def wrapped(argv, *args, **kwargs): (level, argv) = get_level_by_argv(argv) add_root_handler(level) - return main(argv) + return main(argv, *args, **kwargs) return wrapped