output

package
v0.0.0-...-0efc7b6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Unlicense Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedOutput

type BufferedOutput struct {
	NullOutput
	// contains filtered or unexported fields
}

Buffered output classes

func NewBufferedOutput

func NewBufferedOutput(decorated bool, format *formatter.OutputFormatter) *BufferedOutput

constructor

func (*BufferedOutput) Fetch

func (o *BufferedOutput) Fetch() string

Empties buffer and returns its content.

func (*BufferedOutput) Store

func (o *BufferedOutput) Store(message string, level verbosity.Level)

func (*BufferedOutput) StoreBytes

func (o *BufferedOutput) StoreBytes(p []byte) (n int, err error)

type ChanOutput

type ChanOutput struct {
	NullOutput
	// contains filtered or unexported fields
}

Chan output classes

func NewChanOutput

func NewChanOutput(channel chan string, decorated bool, format *formatter.OutputFormatter) *ChanOutput

constructor

func (*ChanOutput) Send

func (o *ChanOutput) Send(message string, level verbosity.Level)

func (*ChanOutput) SendBytes

func (o *ChanOutput) SendBytes(p []byte) (n int, err error)

type ConsoleOutput

type ConsoleOutput struct {
	NullOutput
}

Console output classes

func NewCliOutput

func NewCliOutput(decorated bool, format *formatter.OutputFormatter) *ConsoleOutput

constructor

func (*ConsoleOutput) StdOut

func (o *ConsoleOutput) StdOut(message string, level verbosity.Level)

func (*ConsoleOutput) StdOutBytes

func (o *ConsoleOutput) StdOutBytes(p []byte) (n int, err error)

type NullOutput

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

Null output classes (~abstract)

func NewNullOutput

func NewNullOutput(decorated bool, format *formatter.OutputFormatter) *NullOutput

constructor

func (*NullOutput) Format

func (o *NullOutput) Format(message string) string

func (*NullOutput) Formatter

func (o *NullOutput) Formatter() *formatter.OutputFormatter

Returns current output formatter instance

func (*NullOutput) IsDebug

func (o *NullOutput) IsDebug() bool

func (*NullOutput) IsDecorated

func (o *NullOutput) IsDecorated() bool

Gets the decorated flag

func (*NullOutput) IsQuiet

func (o *NullOutput) IsQuiet() bool

func (*NullOutput) IsVerbose

func (o *NullOutput) IsVerbose() bool

func (*NullOutput) IsVerbosityAllowed

func (o *NullOutput) IsVerbosityAllowed(level verbosity.Level) bool

func (*NullOutput) IsVeryVerbose

func (o *NullOutput) IsVeryVerbose() bool

func (*NullOutput) Print

func (o *NullOutput) Print(message string)

func (*NullOutput) PrintOnVerbose

func (o *NullOutput) PrintOnVerbose(message string, level verbosity.Level)

func (*NullOutput) Println

func (o *NullOutput) Println(message string)

Writes a message to the output and adds a newline at the end

func (*NullOutput) PrintlnOnVerbose

func (o *NullOutput) PrintlnOnVerbose(message string, level verbosity.Level)

Writes a message to the output and adds a newline at the end

func (*NullOutput) SetDecorated

func (o *NullOutput) SetDecorated(decorated bool)

Sets the decorated flag

func (*NullOutput) SetFormatter

func (o *NullOutput) SetFormatter(formatter *formatter.OutputFormatter)

Set current output formatter instance

func (*NullOutput) SetVerbosity

func (o *NullOutput) SetVerbosity(verbosity verbosity.Level)

func (*NullOutput) Verbosity

func (o *NullOutput) Verbosity() verbosity.Level

func (*NullOutput) Void

func (o *NullOutput) Void(message string, level verbosity.Level)

func (*NullOutput) Write

func (o *NullOutput) Write(raw []byte) (n int, err error)

type OutputInterface

type OutputInterface interface {
	// Formats a message according to the current formatter styles.
	Format(message string) string

	// Writes a message to the output.
	Print(message string)

	// Writes a message to the output and adds a newline at the end.
	Println(message string)

	// Writes a message to the output.
	PrintOnVerbose(message string, verbosity verbosity.Level)

	// Writes a message to the output and adds a newline at the end.
	PrintlnOnVerbose(message string, verbosity verbosity.Level)

	// Sets the decorated flag.
	SetDecorated(decorated bool)

	// Gets the decorated flag.
	IsDecorated() bool

	// Sets current output formatter instance.
	SetFormatter(formatter *formatter.OutputFormatter)

	// Gets current output formatter instance.
	Formatter() *formatter.OutputFormatter

	// Sets the verbosity of the output.
	SetVerbosity(verbosity verbosity.Level)

	// Gets the current verbosity of the output.
	Verbosity() verbosity.Level

	// Returns whether verbosity is quiet (-q)
	IsQuiet() bool

	// Returns whether verbosity is verbose (-v)
	IsVerbose() bool

	// Returns whether verbosity is very verbose (-vv)
	IsVeryVerbose() bool

	// Returns whether verbosity is debug (-vvv)
	IsDebug() bool

	// Implements io.Writer
	Write(p []byte) (n int, err error)
}

OutputInterface is the interface implemented by all output classes

Jump to

Keyboard shortcuts

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