Skip to main content

Module stdin

Module stdin 

Source
Expand description

Data piped in: cmd | datui and datui -.

Standard input is read once, to a temporary file, as a phase of the open ([crate::loading]); the scan of that file then stays lazy, as for any file. The format is read off the first bytes, since a pipe has no extension to go by, unless --format or --compression says. Keys come from the terminal meanwhile: Crossterm reads /dev/tty on Unix when standard input is not one, and CONIN$ on Windows.

Constants§

NAME
What data read from standard input is called on screen and in messages.
PATH
The path that names standard input on the command line.

Functions§

as_file
path as a host other than the command line means it: - is a file of that name, since only the command line reads standard input.
carries_data
What piped decides from what standard input is: neither a terminal nor a device.
is_stdin
Whether path names standard input.
named
The name path goes by: stdin for standard input, itself otherwise.
paths_or_stdin
The paths to open: those named, or standard input when none are and something is piped in.
piped
Whether standard input carries data: a pipe or a file. A terminal there is the user, and a device such as /dev/null or Windows’ NUL, where a launcher points it, holds nothing.
refuse
Why standard input cannot be read as asked, before anything is read: nothing is piped in, or it is named with other paths.
sniff
The format and compression the first bytes of a file say it is: compression by its magic numbers, then whatever a format’s signature says ([crate::readers::sniff]), and text no format claims as JSON, CSV or TSV on evidence, lines otherwise (crate::lines::guess). head is all there is when it is shorter than [HEAD].