Python CMD and Argparse Part 1
The CMD Module The cmd module is a really cool tool for Python development - it provides a lightweight wrapper for an interactive command-line interface. It’s quick and easy to add basic commands to your program, and you can give help messages using nothing more than function docstrings. Here’s an example:
from cmd import Cmd class Shell(Cmd): prompt = "\nshell > " def do_exit(self, _) -> bool: """Exits the cmdloop.""" return True def do_print(self, arg: str): """Prints your message.