Simplify error message
This commit is contained in:
parent
9b4805cc19
commit
038c35980b
@ -37,14 +37,16 @@ def magicli(exclude=['main'], help_message=True, glbls=None, argv=None):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
function_to_call(*args, **kwargs)
|
function_to_call(*args, **kwargs)
|
||||||
except TypeError as e:
|
except TypeError:
|
||||||
print_error(e)
|
pass
|
||||||
raise
|
# except TypeError as e:
|
||||||
|
# print_error(e)
|
||||||
|
# raise
|
||||||
|
|
||||||
|
|
||||||
def print_error(e):
|
# def print_error(e):
|
||||||
print('\x1b[91mError:\x1b[0m ', end='')
|
# print('\x1b[91mError:\x1b[0m ', end='')
|
||||||
print(e)
|
# print(e)
|
||||||
|
|
||||||
|
|
||||||
def format_args(argv):
|
def format_args(argv):
|
||||||
@ -58,7 +60,7 @@ def filter_functions(args):
|
|||||||
"""
|
"""
|
||||||
Gets list of functions from the globals variable of a specific module (default: __main__).
|
Gets list of functions from the globals variable of a specific module (default: __main__).
|
||||||
"""
|
"""
|
||||||
return [v for k, v in args.items() if inspect.isfunction(v) and v.__module__ == args['__name__']]
|
return [v for v in args.values() if inspect.isfunction(v) and v.__module__ == args['__name__']]
|
||||||
|
|
||||||
|
|
||||||
def print_help_and_exit(app_name, functions):
|
def print_help_and_exit(app_name, functions):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user