From 4c047bdb2ef595bec87b851f4c54795e7454a8de Mon Sep 17 00:00:00 2001 From: Patrick Elmer Date: Mon, 18 Sep 2023 10:46:08 +0900 Subject: [PATCH] Exclude functions that start with underscore from commands --- magicli/magicli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magicli/magicli.py b/magicli/magicli.py index c7c3fe2..9d734f6 100644 --- a/magicli/magicli.py +++ b/magicli/magicli.py @@ -38,7 +38,7 @@ def magicli(exclude=['main'], glbls=None, argv=None): print(glbls['__version__']) if '__version__' in glbls else print('Unknown version.') exit() - function_to_call, *commands = [f for f in filter_functions(glbls) if f.__name__ not in exclude] + function_to_call, *commands = [f for f in filter_functions(glbls) if f.__name__ not in exclude and not f.__name__.startswith('_')] command_names = [f.__name__ for f in commands] # Call command if specified