Building a Command-Line Interface (CLI) with argparse
A common scenario: you deliver software that runs with a variety of options. What, then, is the best way of letting users invoke the various options? A command line interface (CLI)!
CLIs have been used to run programs since the early 1960s and are still relevant today. Their simplistic design, small footprint, and self-documentation make them ideal for automated or scheduled tasks.
In this course, you will learn how to build a CLI using argparse, a module in the Python Standard Library. The course will also explore alternative, third-party packages for building a CLI: docopt and click.
After completing this course, you will be able to:
- Build a command line interface (CLI) using Python's argparse module
- Accept both required and optional arguments
- Assign a type to an argument
- Write a custom type
- Write a custom action
- Handle mutually exclusive options
- Build a CLI with docopt
- Build a CLI with click