Documentation ¶
Index ¶
- Variables
- func AskYesNo(reader io.Reader, message string, defaultAnswer bool) bool
- func FlushAllOutput()
- func GetColorableOutput() io.Writer
- func GetErrorOutput() io.Writer
- func GetOutput() io.Writer
- func OsStdoutIsTerminal() bool
- func OsStdoutTerminalSize() (width, height int)
- func Print(a ...interface{}) (n int, err error)
- func Printf(format string, a ...interface{}) (n int, err error)
- func Println(a ...interface{}) (n int, err error)
- func ReadLine() (string, error)
- func ReadPassword() (string, error)
- func SetAllOutput(w io.Writer)
- func SetErrorOutput(w io.Writer)
- func SetOutput(w io.Writer)
- type Flusher
- type LockedWriter
- type RemoteTerm
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var (
PrintToError = false
)
Functions ¶
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
GetColorableOutput returns an output supporting ANSI color if output is a terminal
func GetErrorOutput ¶
GetErrorOutput returns the error 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 ¶
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 ¶
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 ¶
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 ReadPassword ¶
ReadPassword reads a password without echoing it to the terminal.
func SetAllOutput ¶
SetAllOutput changes the default and error output for the Print* functions
func SetErrorOutput ¶
SetErrorOutput changes the error 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)
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