term

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskYesNo

func AskYesNo(reader io.Reader, message string, defaultAnswer bool) bool

AskYesNo prompts the user for a message asking for a yes/no answer

func FlushAllOutput added in v0.21.0

func FlushAllOutput()

FlushAllOutput flushes all buffered output (if supported by the underlying Writer).

func GetColorableOutput added in v0.19.0

func GetColorableOutput() io.Writer

GetColorableOutput returns an output supporting ANSI color if output is a terminal

func GetErrorOutput

func GetErrorOutput() io.Writer

GetErrorOutput returns the error output of the Print* functions

func GetOutput

func GetOutput() io.Writer

GetOutput returns the default output of the Print* functions

func OsStdoutIsTerminal added in v0.14.0

func OsStdoutIsTerminal() bool

OsStdoutIsTerminal returns true as os.Stdout is a terminal session

func OsStdoutTerminalSize added in v0.19.0

func OsStdoutTerminalSize() (width, height int)

OsStdoutIsTerminal returns true as os.Stdout is a terminal session

func Print

func Print(a ...interface{}) (n int, err error)

Print formats using the default formats for its operands and writes to standard output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered.

Example
SetOutput(os.Stdout)
Print("ExamplePrint")
Output:

ExamplePrint

func Printf

func Printf(format string, a ...interface{}) (n int, err error)

Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.

func Println

func Println(a ...interface{}) (n int, err error)

Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.

func ReadLine

func ReadLine() (string, error)

ReadLine reads some input

func ReadPassword

func ReadPassword() (string, error)

ReadPassword reads a password without echoing it to the terminal.

func SetAllOutput

func SetAllOutput(w io.Writer)

SetAllOutput changes the default and error output for the Print* functions

func SetErrorOutput

func SetErrorOutput(w io.Writer)

SetErrorOutput changes the error output for the Print* functions

func SetOutput

func SetOutput(w io.Writer)

SetOutput changes the default output for the Print* functions

Types

type Flusher added in v0.21.0

type Flusher interface {
	// Flush writes any pending bytes to output
	Flush() error
}

Flusher allows a Writer to declare it may buffer content that can be flushed

type LockedWriter added in v0.17.0

type LockedWriter struct {
	// contains filtered or unexported fields
}

func (*LockedWriter) Flush added in v0.21.0

func (w *LockedWriter) Flush() (err error)

func (*LockedWriter) Write added in v0.17.0

func (w *LockedWriter) Write(p []byte) (n int, err error)

type RemoteTerm

type RemoteTerm struct {
	// contains filtered or unexported fields
}

RemoteTerm is used to send terminal output remotely

func NewRemoteTerm

func NewRemoteTerm(client *remote.Client) *RemoteTerm

NewRemoteTerm creates a new RemoteTerm based on a remote.Client

func (*RemoteTerm) Write

func (t *RemoteTerm) Write(p []byte) (n int, err error)

Write terminal data remotely

Jump to

Keyboard shortcuts

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