Wake
The main use case for wake()
has been covered in the
introductory tutorial. Specifically, after all commands have
been register()
ed, wake()
is
used to wake from a coma.
The only additional use case is simulating command line arguments using
args
and namespace
, which are simply passed to
ArgumentParser.parse_known_args():
import coma
if __name__ == "__main__":
coma.register("greet", lambda: print("Hello World!"))
coma.wake(["greet"])
Running this program without providing command line arguments works because
wake()
is simulating greet
as a command line argument:
$ python main.py
Hello World!