termio

package
v0.0.0-...-10f8213 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Handles terminal input/output. Based on GH CLI implementation at https://github.com/cli/cli/blob/trunk/pkg/iostreams/iostreams.go

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultIO = New()
)

Functions

func Error

func Error(s string)

func Errorf

func Errorf(s string, args ...any)

func IsInteractive

func IsInteractive() bool

func IsTerminal

func IsTerminal(f *os.File) bool

func NewStyle

func NewStyle(enabled, is256enabled, trueColor bool) *style

func Print

func Print(s string)

func PrintErr

func PrintErr(s string)

func Printf

func Printf(s string, args ...any)

func StderrIsTerminal

func StderrIsTerminal() bool

func StdinIsTerminal

func StdinIsTerminal() bool

func StdoutIsTerminal

func StdoutIsTerminal() bool

func Style

func Style() *style

func Warn

func Warn(s string)

func Warnf

func Warnf(s string, args ...any)

Types

type Config

type Config struct {
	ColorDisabled    bool
	Color256Enabled  bool
	TrueColorEnabled bool
}

func ConfigFromEnv

func ConfigFromEnv() *Config

type IO

type IO struct {
	In     io.Reader
	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

func New

func New() *IO

func NewWithConfig

func NewWithConfig(cfg *Config) *IO

func WithNeverPrompt

func WithNeverPrompt(v bool) *IO

func (*IO) Error

func (io *IO) Error(s string)

func (*IO) Errorf

func (io *IO) Errorf(s string, args ...any)

func (*IO) IsInteractive

func (io *IO) IsInteractive() bool

func (*IO) Print

func (io *IO) Print(s string)

func (*IO) PrintErr

func (io *IO) PrintErr(s string)

func (*IO) Printf

func (io *IO) Printf(s string, args ...any)

func (*IO) SetNeverPrompt

func (io *IO) SetNeverPrompt(v bool)

func (*IO) StderrIsTerminal

func (io *IO) StderrIsTerminal() bool

func (*IO) StdinIsTerminal

func (io *IO) StdinIsTerminal() bool

func (*IO) StdoutIsTerminal

func (io *IO) StdoutIsTerminal() bool

func (*IO) Style

func (io *IO) Style() *style

func (*IO) Warn

func (io *IO) Warn(s string)

func (*IO) Warnf

func (io *IO) Warnf(s string, args ...any)

Jump to

Keyboard shortcuts

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