Interactive command-line (CLI) applications are extremely popular in the DevOps and Security communities as well as for internal tooling and automation. Have you ever wanted to build an awesome CLI application using Python but don't know where to get started? This talk will show you how to use the cmd2 package to quickly and easily build feature-rich and user-friendly CLI apps in Python.
Interactive command-line applications (CLIs) are used extensively in many real-world scenarios, particularly in the DevOps and Security communities as well as for internal developer tooling and automation. I'm sure many of you have used the wonderful ipython interactive Python shell which is a good example of a CLI. Python has the built-in cmd library for creating CLIs, but it is extremely bare-bones. The cmd2 package is a batteries-included extension of cmd which makes it much quicker and easier to create feature-rich and user-friendly CLIs.
The presentation will first explain how to install cmd2. The talk will next show how to create a basic cmd2 application. Then the talk will progressively add features to this application while demonstrating the capabilities built into cmd2. In the end, the presentation will show how to build a basic but feature-rich and user-friendly CLI application from scratch. This application will include many features which make it easy to use for customers, including:
- Built-in help
- Top-notch tab-completion
- Shell-like functionality including ability to run shell commands, pipe to shell commands, and redirect output to files
- Built-in application scripting
- Built-in Python scripting
- Built-in history
- Command aliases and macros
Ultimately, people who attend this talk will learn how to use the Python programming language with the cmd2 package to quickly and efficiently build their own interactive command-line applications.