Rust atty

From wikinotes
Revision as of 08:18, 9 February 2023 by Will (talk | contribs) (Created page with "A cross platform way of determining if your stdin/stdout/stderr is a tty or not.<br> built overtop of each platform's native APIs. = Documentation = <blockquote> {| class="wikitable" |- | github || https://github.com/softprops/atty |- |} </blockquote><!-- Documentation --> = Install = <blockquote> <syntaxhighlight lang="toml"> # Cargo.toml [dependencies] atty = "0.2" </syntaxhighlight> </blockquote><!-- Install --> = Usage = <blockquote> <syntaxhighlight lang="rust">...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A cross platform way of determining if your stdin/stdout/stderr is a tty or not.
built overtop of each platform's native APIs.

Documentation

github https://github.com/softprops/atty

Install

# Cargo.toml

[dependencies]
atty = "0.2"

Usage

if !atty::is(Stream::Stdin) {
    // read from pipe
}