Change implementation to be callable only with

This commit is contained in:
Patrick Elmer 2022-12-28 11:00:30 +01:00
parent 4f07d7a436
commit 9b4805cc19

View File

@ -76,3 +76,17 @@ def print_help_and_exit(app_name, functions):
words += ['--' + arg for arg in specs.args] words += ['--' + arg for arg in specs.args]
print(' '*4 + ' '.join(words)) print(' '*4 + ' '.join(words))
exit() exit()
def first_calling_frame():
for s in reversed(inspect.stack()):
if s.code_context == None:
continue
if s.code_context[0].startswith('import magicli'):
return s.frame
return None
frame = first_calling_frame()
if frame != None:
magicli(glbls=frame.f_globals)