chk

package
v0.8.66 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package chk provides some checked terminal utilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvironmentOverrideColors bool  = true
	DisableColors             bool  // no colorful paint? false to disable colorful paint.
	ForceColors               bool  // always colorful paint? true to enable colorful paint even if the underlying tty cannot support ANSI escaped sequences.
	MinVal                    int64 // 0,16,88,256, or 1<<24
)

Functions

func IsColored

func IsColored(w io.Writer) bool

IsColored detects a writer if it is a colorful tty device.

A colorful tty device can receive ANSI escaped sequences and draw its.

func IsColorful

func IsColorful(w io.Writer) (colorful bool)

IsColorful detects a writer if it is a colorful tty device.

A colorful tty device can receive ANSI escaped sequences and draw its.

func IsTty

func IsTty(w io.Writer) bool

IsTty detects a writer if it is abstracting from a tty (console, terminal) device.

func ReadTill

func ReadTill(fd int, delim byte) (line string, delimMatched bool, err error)

ReadTill reads a line or a string ending with delim of input from a terminal without local echo.

func StatStdout

func StatStdout() (normalFile, redirected, piped, term bool)

func StatStdoutString

func StatStdoutString() (status string)

func StdoutIsPiped

func StdoutIsPiped() (b bool)

func StringToBool

func StringToBool(val string, defaultVal ...bool) (ret bool)

func ToBool

func ToBool(val any, defaultVal ...bool) (ret bool)

ToBool translate a value (int, bool, string) to boolean

Types

This section is empty.

Jump to

Keyboard shortcuts

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