Change implementation to be callable only with
This commit is contained in:
parent
4f07d7a436
commit
9b4805cc19
@ -76,3 +76,17 @@ def print_help_and_exit(app_name, functions):
|
||||
words += ['--' + arg for arg in specs.args]
|
||||
print(' '*4 + ' '.join(words))
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user