Why CLIs?
CLI applications live in an interesting space, where human-computer interaction naturally blends with automation and programming.
Command-line interfaces are often defined as just that: text-based interfaces or APIs. This makes some sense, as CLI are well useable for humans to input commands and for machine-to-machine automation and scripting. It could be a utilitarian script performing a single action. Or a major application meant to run continuously as a service.
The textual interface crosses architectural paradigms, programming languages, and operating systems. CLI applications are a rather specific area. In many ways close to GUI/desktop applications, with a specific lifecycle. In other ways, CLI applications greatly benefit from being aware of and sometimes implementing current trends in the cloud and DevOps.
CLI application could be a massive ecosystem on its own. With hundreds of commands and options, complex integrations or 3rd party plugins. Or it could be a companion application to another product or a single-purpose utility.
Command-line interfaces are with us for decades. They accumulated layers of practices and rules but also evolved together with the ecosystems built around them.
Introduction
This document should act as a best practices showcase and reference for anyone working on CLI applications or tooling.
There are 3 main sections, all born out of frustration when working on CLIs:
- Designing a CLI: outlining common topics, patterns and pitfalls.
- How-to guides: a collection of tips and tricks for tackling specific problems.
- Glossary of CLI-related terms and concepts