Python class to build async-compatible line-oriented command interpreter
Project description
aiocmdline
Python has a builtin module that provides a line-oriented command interpreter. However, the builtin module is difficult to use with async Python code. This module provides a ready-to-use class that simplifies the implementation of regular and async commands.
Dependencies:
- aioreadline
Example
class MyCmdline(AIOCmdline):
def do_quit(self):
self.stop_cmdloop()
async def do_sleep(self, arg):
await asyncio.sleep(int(arg))
print("sleep done")
mycmdline = MyCmdline(prompt="mycmd> ", history=True)
mycmdline.cmdloop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiocmdline-2024.1.25.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for aiocmdline-2024.1.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85aa96766082b9c0e3d3c76c28b662813aed3d7079479226ea0121baba18099a |
|
MD5 | d55062771ae4ec0a67c2201ba9690762 |
|
BLAKE2b-256 | 5c6620cb5c4dd7855568abf098e37095794414a16bcbb470f3b0a4e03c47ecc7 |