--- id: cmd2 version: "4.2.0" license: MIT license_treatment: permissive maintenance: active --- # cmd2 — cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python License: permissive · Maintenance: active · Downloads: 2.4M/mo ## What it is and what it does cmd2 extends Python's built-in cmd module to simplify building feature-rich interactive command-line applications. It provides automatic tab completion for commands, subcommands, file paths, and argparse-defined flags; rich help text generation; and scripting capabilities through text files and Python scripts. The framework is designed to bridge the gap between easy command discovery (via completion and help) and workflow automation (via aliases, macros, and scripting), making it suitable for both exploratory CLI tools and production automation systems. The package depends on prompt-toolkit for terminal interaction, rich for colored output and formatting, rich-argparse for integrated argument help, and pyperclip for clipboard support. It has been actively maintained since 2008 and currently targets Python 3.11 and later, including free-threaded Python variants. With no known security vulnerabilities and a permissive MIT license, it is production-ready for developers building admin tools, interactive shells, or complex CLI workflows. Use it for: - Build system administration tools with discoverable commands and tab completion for file paths and options. - Create interactive debugging or diagnostic shells that support scripting and command history. - Develop workflow automation CLIs that transition smoothly from interactive exploration to batch scripting. - Implement interactive REPL-style applications for data analysis or configuration management. - Build security or penetration testing frameworks with command aliasing and macro support. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. cmd2 is a Python framework for building interactive command-line applications with built-in tab completion, help text generation, scripting, and automation features. Yes. cmd2 is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It is well-suited for any Python developer building interactive CLI applications that need tab completion, help generation, and scripting support. The framework is production-stable (Development Status 5) and supports current Python versions. ## Install pip install cmd2 uv add cmd2 poetry add cmd2 ## Installing cmd2 Before you install: Low install friction with only 4 runtime dependencies (prompt-toolkit, pyperclip, rich, rich-argparse). Actively maintained with a release 8 days ago. Supports current Python versions (3.11+) including free-threaded variants. License in practice: MIT license permits commercial and private use with minimal restrictions—suitable for most projects without licensing concerns. Quickstart: pip install cmd2 import cmd2 class MyApp(cmd2.Cmd): def do_hello(self, _: cmd2.Statement): self.poutput('Hello') if __name__ == '__main__': MyApp().cmdloop() Requires Python 3.11 or later. Verify before relying: - Whether the framework supports subcommand hierarchies beyond what argparse provides. - Performance characteristics when handling large command sets or high-frequency tab completion. - Compatibility with async/await patterns in user-defined commands. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 2.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags interactive command line framework, CLI application builder, tab completion for CLI, command-line REPL, Python cmd module extension, interactive shell framework, command scripting automation, cli-framework, interactive-shell, repl [View on SkillFed](https://skillfed.io/packages/cmd2) · [View on PyPI](https://pypi.org/project/cmd2/)