Module libpt_cli::printing

source ·
Expand description

Utilities for formatting, bordering, aligning and printing text content

This module provides functions for formatting content with borders and colors, printing them to the console. The functions in this module are designed to simplify the process of creating visually appealing output for CLI applications.

Note that most of the utilities in this module are focused on communication with humans, not with machines. Consider evaluating std::io::IsTerminal before using colorful, dynamic and bordered printing. If you are talking to a machine, it might be useful to not add extra space, add a newline per output or even output JSON. An example that does this well is ls:

$ ls
Cargo.lock  Cargo.toml  data  LICENSE  members  README.md  scripts  src  target
$ ls | cat
Cargo.lock
Cargo.toml
data
LICENSE
members
README.md
scripts
src
target

See the CLI Rustbook for more information on the topic.

Functions§