CLI Design Considerations
"Traditionally, UNIX commands were written under the assumption they were going to be used primarily by other programs. They had more in common with functions in a programming language than with graphical applications." "Today, even though many CLI programs are used primarily (or even exclusively) by humans, a lot of their interaction design still carries the baggage of the past. Itβs time to shed some of this baggage: if a command is going to be used primarily by humans, it should be designed for humans first."
https://clig.dev
- Standard in/out/err
- Signals
- Exit codes
- Use of config (e.g. YAML, JSON, etc)
- Anticipant users not using it as you anticipated
- Designing for composability
- Output verbosity
- Whether to use a "top", such as HTop
Guides
Conventions
> mycli --descriptive
> mycli -d
Subcommand Choices
netlify functions:invoke
netlify functions invoke
Concept of a TUI
TUI stands for Terminal User Interface and basically describes an app that runs in the terminal (in the same manner as a CLI-based application) that has a more interactive user interface.
Examples
- https://github.com/oz/tz
- https://github.com/charmbracelet/soft-serve
Things to consider for a TUI...
- Autocompletion (e.g. https://github.com/chriswalz/bit)
- Color and visual representation
Libraries
- Inquirer
- Chalk
- Charm
- React Ink - React for interactive command-line apps
- Cobra - ...library for creating powerful modern CLI applications
- blessed - curses-like library with a high level terminal interface API for node.js
- nice - highly customizable and lightweight framework for crafting CLI apps
- laterna - Java library allowing you to write easy semi-graphical user interfaces
Great CLIs
- CLI tools you won't be able to live without
- git
- kubectl
- brew