stdin

package
v0.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stdin provides simple utilities for reading from stdin, as well as determining if stdin is a terminal or if something has been piped to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasInput

func HasInput() bool

HasInput reports true when stdin is **not** a terminal. This covers pipes (echo foo | app), file redirects (app < file), and CI/dev‑null situations. It never blocks.

func IsInteractive

func IsInteractive() bool

IsInteractive reports whether the program is attached to a real terminal.

func IsPiped

func IsPiped() bool

IsPiped checks if something has been piped to stdin.

func MaybePiped

func MaybePiped() (bool, error)

MaybePiped checks if something has been piped to stdin.

func Read

func Read() (string, error)

Read returns stdin as a string, trimming the trailing newline.

func ReadAll added in v0.1.0

func ReadAll() (data string, read bool, err error)

ReadAll consumes stdin and returns the trimmed string plus a flag that tells whether any bytes were actually read.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL