cli

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Overview

Package cli implements printing functionality for CLI output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(format string, a ...any)

Print formats a string.

func Println

func Println(format string, a ...any)

Println formats a string and adds a new line.

Types

type In added in v0.0.9

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

In is an input stream used by the DockerCli to read user input

func NewIn added in v0.0.9

func NewIn(in io.ReadCloser) *In

NewIn returns a new In object from a ReadCloser

func (*In) CheckTty added in v0.0.9

func (i *In) CheckTty(attachStdin, ttyMode bool) error

CheckTty checks if we are trying to attach to a container tty from a non-tty client input stream, and if so, returns an error.

func (*In) Close added in v0.0.9

func (i *In) Close() error

Close implements the Closer interface

func (*In) FD added in v0.0.9

func (s *In) FD() uintptr

FD returns the file descriptor number for this stream

func (*In) IsTerminal added in v0.0.9

func (s *In) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal

func (*In) Read added in v0.0.9

func (i *In) Read(p []byte) (int, error)

func (*In) RestoreTerminal added in v0.0.9

func (s *In) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal

func (*In) SetIsTerminal added in v0.0.9

func (s *In) SetIsTerminal(isTerminal bool)

SetIsTerminal sets the boolean used for isTerminal

func (*In) SetRawTerminal added in v0.0.9

func (i *In) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

type Out added in v0.0.9

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

Out is an output stream used by the DockerCli to write normal program output.

func NewOut added in v0.0.9

func NewOut(out io.Writer) *Out

NewOut returns a new Out object from a Writer

func (*Out) FD added in v0.0.9

func (s *Out) FD() uintptr

FD returns the file descriptor number for this stream

func (*Out) GetTtySize added in v0.0.9

func (o *Out) GetTtySize() (uint, uint)

GetTtySize returns the height and width in characters of the tty

func (*Out) IsTerminal added in v0.0.9

func (s *Out) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal

func (*Out) RestoreTerminal added in v0.0.9

func (s *Out) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal

func (*Out) SetIsTerminal added in v0.0.9

func (s *Out) SetIsTerminal(isTerminal bool)

SetIsTerminal sets the boolean used for isTerminal

func (*Out) SetRawTerminal added in v0.0.9

func (o *Out) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

func (*Out) Write added in v0.0.9

func (o *Out) Write(p []byte) (int, error)

type Streams

type Streams interface {
	// In returns the reader used for stdin
	In() *In
	// Out returns the writer used for stdout
	Out() *Out
	// Err returns the writer used for stderr
	Err() io.Writer
}

Streams is an interface which exposes the standard input and output streams

func NoopStreams added in v0.2.4

func NoopStreams() Streams

NoopStreams provides streams like /dev/null.

func StandardStreams added in v0.0.9

func StandardStreams() Streams

StandardStreams sets a cli in, out and err streams with the standard streams.

Jump to

Keyboard shortcuts

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