docs(cli): expand on IsTerminal differences
cargo devel CI / cargo CI (push) Successful in 2m5s Details

This commit is contained in:
Christoph J. Scherr 2024-06-28 14:50:13 +02:00
parent db2fd9f60e
commit 3e5174dab6
1 changed files with 23 additions and 1 deletions

View File

@ -6,7 +6,29 @@
//!
//! 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.
//! 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`:
//!
//! ```bash
//! $ ls
//! Cargo.lock Cargo.toml data LICENSE members README.md scripts src target
//! ```
//!
//! ```bash
//! $ ls | cat
//! Cargo.lock
//! Cargo.toml
//! data
//! LICENSE
//! members
//! README.md
//! scripts
//! src
//! target
//! ```
//!
//! See the [CLI Rustbook](https://rust-cli.github.io/book/in-depth/machine-communication.html) for
//! more information on the topic.
use comfy_table::presets;
use comfy_table::{CellAlignment, ContentArrangement, Table};