Skip to main content

cmd2 - a tool for building interactive command line applications in Python

Project description

cmd2 is a tool for building interactive command line applications in Python. Its goal is to make it quick and easy for developers to build feature-rich and user-friendly interactive command line applications. It provides a simple API which is an extension of Python’s built-in cmd module. cmd2 provides a wealth of features on top of cmd to make your life easier and eliminates much of the boilerplate code which would be necessary when using cmd.

The latest documentation for cmd2 can be read online here: https://cmd2.readthedocs.io/

Main features:

  • Searchable command history (history command and <Ctrl>+r)

  • Text file scripting of your application with load (@) and _relative_load (@@)

  • Python scripting of your application with pyscript

  • Run shell commands with !

  • Pipe command output to shell commands with |

  • Redirect command output to file with >, >>; input from file with <

  • Bare >, >> with no filename send output to paste buffer (clipboard)

  • py enters interactive Python console (opt-in ipy for IPython console)

  • Multi-line commands

  • Special-character command shortcuts (beyond cmd’s ? and !)

  • Settable environment parameters

  • Parsing commands with arguments using argparse, including support for sub-commands

  • Unicode character support (Python 3 only)

  • Good tab-completion of commands, sub-commands, file system paths, and shell commands

  • Python 2.7 and 3.4+ support

  • Linux, macOS and Windows support

  • Trivial to provide built-in help for all commands

  • Built-in regression testing framework for your applications (transcript-based testing)

  • Transcripts for use with built-in regression can be automatically generated from history -t

Usable without modification anywhere cmd is used; simply import cmd2.Cmd in place of cmd.Cmd.

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

cmd2-0.8.6.tar.gz (110.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmd2-0.8.6-py2.py3-none-any.whl (51.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cmd2-0.8.6.tar.gz.

File metadata

  • Download URL: cmd2-0.8.6.tar.gz
  • Upload date:
  • Size: 110.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cmd2-0.8.6.tar.gz
Algorithm Hash digest
SHA256 ef4a4166882066314d6e8e8362b515e5b9839f401d1f32d6aa6ac871af24980b
MD5 31231e073dc5ecdc4cf4f3c0f5f2299e
BLAKE2b-256 c65e02f55ac6827d663c767a06cd508699964bd19f15c80e2c26be1189c979bf

See more details on using hashes here.

File details

Details for the file cmd2-0.8.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cmd2-0.8.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c635097c43974da969bfc1a2c43b57382501dee66fce2289bb2227a2d659a2d5
MD5 61b424fdbaa27566aaf51dbce36e9796
BLAKE2b-256 881e250cb2718e6c1b33713ea46526df24156e8e51c9494b549da196dfbcf9a9

See more details on using hashes here.

Supported by

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