is-terminal
for platform
Check if stdin, stdout, or stderr is a terminal.
Signature
> is-terminal {flags}
Flags
--stdin, -i
: Check if stdin is a terminal--stdout, -o
: Check if stdout is a terminal--stderr, -e
: Check if stderr is a terminal
Input/output types:
input | output |
---|---|
nothing | bool |
Examples
Return "terminal attached" if standard input is attached to a terminal, and "no terminal" if not.
> if (is-terminal --stdin) { "terminal attached" } else { "no terminal" }
terminal attached