Skip to main content

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


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

Uploaded Source

Built Distribution

aiocmdline-2024.1.25-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file aiocmdline-2024.1.25.tar.gz.

File metadata

  • Download URL: aiocmdline-2024.1.25.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for aiocmdline-2024.1.25.tar.gz
Algorithm Hash digest
SHA256 5e72ff43de2042d9f951843a819822a4e337daddd0e5ee002473bbb3cd507d3b
MD5 f9b9c7106b86ed3107aa9b2e6a4e3d81
BLAKE2b-256 cbba3d56ac5dee3399f35443ed001b569993c9ef340c6588c120fb7d9cc40b07

See more details on using hashes here.

File details

Details for the file aiocmdline-2024.1.25-py3-none-any.whl.

File metadata

File hashes

Hashes for aiocmdline-2024.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 85aa96766082b9c0e3d3c76c28b662813aed3d7079479226ea0121baba18099a
MD5 d55062771ae4ec0a67c2201ba9690762
BLAKE2b-256 5c6620cb5c4dd7855568abf098e37095794414a16bcbb470f3b0a4e03c47ecc7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page