Skip to content

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

Great CLIs

Completion