Skip to content

Instantly share code, notes, and snippets.

@ixe013
ixe013 / aoicmd.py
Created February 20, 2019 04:26
Python Cmd cmdloop replacement to make it asyncio aware
#See https://stackoverflow.com/q/54425723/591064 for usage
async def adapter_cmdloop(self, intro=None):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
"""
self.preloop()
#This is the same code as the Python 3.7.2 Cmd class, with the