Exclude functions that start with underscore from commands

This commit is contained in:
Patrick Elmer 2023-09-18 10:46:08 +09:00
parent 4878b85d2f
commit 4c047bdb2e

View File

@ -38,7 +38,7 @@ def magicli(exclude=['main'], glbls=None, argv=None):
print(glbls['__version__']) if '__version__' in glbls else print('Unknown version.') print(glbls['__version__']) if '__version__' in glbls else print('Unknown version.')
exit() 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] command_names = [f.__name__ for f in commands]
# Call command if specified # Call command if specified