Skip to content

Python class to build async-compatible line-oriented command interpreter

License

Notifications You must be signed in to change notification settings

anyc/aiocmdline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()

About

Python class to build async-compatible line-oriented command interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages