iostreams

package
v0.0.0-...-2b706d3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const EOL = "\n"

EOL is a line break for Unix machines.

Variables

View Source
var ConfirmQuestionTemplate = fmt.Sprintf(`
{{- if .ShowHelp }}{{- color .Config.Icons.Help.Format }}{{ .Config.Icons.Help.Text }} {{ .Help }}{{color "reset"}}{{"\n"}}{{end}}
{{- color .Config.Icons.Question.Format }}{{ .Config.Icons.Question.Text }} {{color "reset"}}
{{- color "default+hb"}}{{ .Message }} {{color "reset"}}
{{- if .Answer}}
  {{- color "%s"}}{{.Answer}}{{color "reset"}}{{"\n"}}
{{- else }}
  {{- if and .Help (not .ShowHelp)}}{{color "cyan"}}[{{ .Config.HelpInput }} for help]{{color "reset"}} {{end}}
  {{- color "%s"}}{{if .Default}}(Y/n) {{else}}(y/N) {{end}}{{color "reset"}}
{{- end}}`, blue(), gray())

ConfirmQuestionTemplate is the formatted template for the confirm prompt

Reference: https://github.com/go-survey/survey/blob/fa37277e6394c29db7bcc94062cb30cd7785a126/confirm.go#L25

View Source
var InputQuestionTemplate = fmt.Sprintf(`
{{- if .ShowHelp }}{{- color .Config.Icons.Help.Format }}{{ .Config.Icons.Help.Text }} {{ .Help }}{{color "reset"}}{{"\n"}}{{end}}
{{- color .Config.Icons.Question.Format }}{{ .Config.Icons.Question.Text }} {{color "reset"}}
{{- color "default+hb"}}{{ .Message }} {{color "reset"}}
{{- if .ShowAnswer}}
  {{- color "%s"}}{{.Answer}}{{color "reset"}}{{"\n"}}
{{- else if .PageEntries -}}
  {{- .Answer}} [Use arrows to move, enter to select, type to continue]
  {{- "\n"}}
  {{- range $ix, $choice := .PageEntries}}
    {{- if eq $ix $.SelectedIndex }}{{color $.Config.Icons.SelectFocus.Format }}{{ $.Config.Icons.SelectFocus.Text }} {{else}}{{color "default"}}  {{end}}
    {{- $choice.Value}}
    {{- color "reset"}}{{"\n"}}
  {{- end}}
{{- else }}
  {{- if or (and .Help (not .ShowHelp)) .Suggest }}{{color "cyan"}}[
    {{- if and .Help (not .ShowHelp)}}{{ print .Config.HelpInput }} for help {{- if and .Suggest}}, {{end}}{{end -}}
    {{- if and .Suggest }}{{color "cyan"}}{{ print .Config.SuggestInput }} for suggestions{{end -}}
  ]{{color "reset"}} {{end}}
  {{- if .Default}}{{color "white"}}({{.Default}}) {{color "reset"}}{{end}}
{{- end}}`, blue())

InputQuestionTemplate is a formatted template for the a text based prompt

Reference: https://github.com/go-survey/survey/blob/fa37277e6394c29db7bcc94062cb30cd7785a126/input.go#L43

View Source
var MultiSelectQuestionTemplate = fmt.Sprintf(`
{{- define "option"}}
    {{- if eq .SelectedIndex .CurrentIndex }}{{color .Config.Icons.SelectFocus.Format }}{{ .Config.Icons.SelectFocus.Text }}{{color "reset"}}{{else}} {{end}}
    {{- if index .Checked .CurrentOpt.Index }}{{color .Config.Icons.MarkedOption.Format }} {{ .Config.Icons.MarkedOption.Text }} {{else}}{{color .Config.Icons.UnmarkedOption.Format }} {{ .Config.Icons.UnmarkedOption.Text }} {{end}}
    {{- color "reset"}}
    {{- " "}}{{- .CurrentOpt.Value}}{{ if ne ($.GetDescription .CurrentOpt) "" }} - {{color "cyan"}}{{ $.GetDescription .CurrentOpt }}{{color "reset"}}{{end}}
{{end}}
{{- if .ShowHelp }}{{- color .Config.Icons.Help.Format }}{{ .Config.Icons.Help.Text }} {{ .Help }}{{color "reset"}}{{"\n"}}{{end}}
{{- color .Config.Icons.Question.Format }}{{ .Config.Icons.Question.Text }} {{color "reset"}}
{{- color "default+hb"}}{{ .Message }}{{color "reset"}}
{{- if .ShowAnswer}}{{color "%s"}} {{.Answer}}{{color "reset"}}{{"\n"}}
{{- else }}
	{{- "  "}}{{- color "%s"}}[Space to select{{- if not .Config.RemoveSelectAll }}, <right> to all{{end}}{{- if not .Config.RemoveSelectNone }}, <left> to none{{end}}{{- if and .Help (not .ShowHelp)}}, {{ .Config.HelpInput }} for more help{{end}}]{{color "reset"}}
  {{- "\n"}}
  {{- range $ix, $option := .PageEntries}}
    {{- template "option" $.IterateOption $ix $option}}
  {{- end}}
{{- end}}`, blue(), blue())

MultiSelectQuestionTemplate represents a formatted template with all hints and filters removed

Reference: https://github.com/go-survey/survey/blob/fa37277e6394c29db7bcc94062cb30cd7785a126/multiselect.go#L71

Functions

func MatchPromptConfig

func MatchPromptConfig(match PromptConfig) interface{}

MatchPromptConfig helps find the prompt with a matching config for mocking

func MimicInputPrompt

func MimicInputPrompt(message string, value string) string

MimicInputPrompt formats a message and value to appear as a prompted input

func SurveyOptions

func SurveyOptions(cfg PromptConfig) []survey.AskOpt

SurveyOptions returns the current options applied to survey prompts

Types

type BoundariedWriter

type BoundariedWriter struct {
	Active bool
	Bounds string
	Buff   io.Writer
	Stream io.Writer
}

BoundariedWriter writes output between bounds to buff and streams everything

func (*BoundariedWriter) Write

func (bw *BoundariedWriter) Write(p []byte) (n int, err error)

Write writes the message to stream and captures between bounds in buffer

type BufferedWriter

type BufferedWriter struct {
	Buff   io.Writer
	Stream io.Writer
}

BufferedWriter contains two writers to write to

func (BufferedWriter) Write

func (bw BufferedWriter) Write(p []byte) (n int, err error)

Write writes the same message to both writers

type ConfirmPromptConfig

type ConfirmPromptConfig struct {
	Required bool // If a response is required
}

ConfirmPromptConfig holds additional configs for a Confirm prompt

func (ConfirmPromptConfig) GetFlags

func (cfg ConfirmPromptConfig) GetFlags() []*pflag.Flag

GetFlags returns all flags for the Confirm prompt

func (ConfirmPromptConfig) IsRequired

func (cfg ConfirmPromptConfig) IsRequired() bool

IsRequired returns if a response is required

type ExitCode

type ExitCode int32
const (
	ExitOK     ExitCode = 0
	ExitError  ExitCode = 1
	ExitCancel ExitCode = 130
)

Exit codes to return to the shell upon exiting

https://tldp.org/LDP/abs/html/exitcodes.html

type FilteredWriter

type FilteredWriter struct {
	Active bool
	Bounds string
	Stream io.Writer
}

FilteredWriter writes output not between bounds

func (FilteredWriter) Write

func (fw FilteredWriter) Write(p []byte) (n int, err error)

Write writes output not between bounds to the stream

type IOStreamer

type IOStreamer interface {
	// Reader contains implementation of readers that read input streams
	Reader
	// Printer contains implementations of printers that output to display and file
	Printer
	// Writer contains implementations of io.Writer to log and output inputs
	Writer

	// SetCmdIO sets the Cobra command I/O to match the IOStream
	SetCmdIO(cmd *cobra.Command)

	// IsTTY returns true if the device is an interactive terminal
	IsTTY() bool

	// GetExitCode returns the most-recently set desired exit code in a thread safe way
	GetExitCode() ExitCode
	// SetExitCode sets the desired process exit code in a thread safe way
	SetExitCode(code ExitCode)

	// ConfirmPrompt prompts the user for a "yes" or "no" (true or false) value
	// for the message
	ConfirmPrompt(ctx context.Context, message string, defaultValue bool) (bool, error)
	// InputPrompt prompts the user for a string value for the message, which
	// can be required
	InputPrompt(ctx context.Context, message string, cfg InputPromptConfig) (string, error)
	// MultiSelectPrompt prompts the user to choose multiple options
	MultiSelectPrompt(ctx context.Context, message string, options []string) ([]string, error)
	// PasswordPrompt prompts the user for a string value with the message,
	// replacing typed characters with '*'
	PasswordPrompt(ctx context.Context, message string, cfg PasswordPromptConfig) (PasswordPromptResponse, error)
	// SelectPrompt prompts the user to choose one of the options
	SelectPrompt(ctx context.Context, message string, options []string, cfg SelectPromptConfig) (SelectPromptResponse, error)

	// InitLogFile will start the debug info to
	// .slack/logs/slack-debug-[date].log with debug-ability data
	InitLogFile(ctx context.Context) error
	// FinishLogFile will end the debug info to
	// .slack/logs/slack-debug-[date].log with debug-ability data
	FinishLogFile(ctx context.Context)
	// FlushToLogFile flushes messages to the logs and logstash
	FlushToLogFile(ctx context.Context, prefix string, errStr string) error
}

type IOStreams

type IOStreams struct {
	Stdin  io.Reader
	Stdout *log.Logger
	Stderr *log.Logger
	// contains filtered or unexported fields
}

func NewIOStreams

func NewIOStreams(config *config.Config, fsFuncs afero.Fs, osFuncs types.Os) *IOStreams

NewIOStreams sets the config and standard I/O for a new IOStreams

func (*IOStreams) ConfirmPrompt

func (io *IOStreams) ConfirmPrompt(ctx context.Context, message string, defaultValue bool) (bool, error)

ConfirmPrompt prompts the user for a "yes" or "no" (true or false) value for the message

func (*IOStreams) FinishLogFile

func (io *IOStreams) FinishLogFile(ctx context.Context)

FinishLogFile will end the debug info to .slack/logs/slack-debug-[date].log with debug-ability data

func (*IOStreams) FlushToLogFile

func (io *IOStreams) FlushToLogFile(ctx context.Context, prefix, errStr string) error

FlushToLogFile will append the error to .slack/logs/slack-debug-[date].log

func (*IOStreams) GetExitCode

func (io *IOStreams) GetExitCode() ExitCode

GetExitCode returns the most-recently set desired exit code in a thread safe way

func (*IOStreams) InitLogFile

func (io *IOStreams) InitLogFile(ctx context.Context) error

InitLogFile will start the debug info to .slack/logs/slack-debug-[date].log with debug-ability data

func (*IOStreams) InputPrompt

func (io *IOStreams) InputPrompt(ctx context.Context, message string, cfg InputPromptConfig) (string, error)

InputPrompt prompts the user for a string value for the message, which can optionally be made required

func (*IOStreams) IsTTY

func (io *IOStreams) IsTTY() bool

IsTTY returns true if the device is an interactive terminal

Reference: https://rderik.com/blog/identify-if-output-goes-to-the-terminal-or-is-being-redirected-in-golang/

func (*IOStreams) MultiSelectPrompt

func (io *IOStreams) MultiSelectPrompt(ctx context.Context, message string, options []string) ([]string, error)

MultiSelectPrompt prompts the user to select multiple values in a list and returns the selected values

func (*IOStreams) PasswordPrompt

func (io *IOStreams) PasswordPrompt(ctx context.Context, message string, cfg PasswordPromptConfig) (PasswordPromptResponse, error)

PasswordPrompt prompts the user with a hidden text input for the message

func (*IOStreams) PrintDebug

func (io *IOStreams) PrintDebug(ctx context.Context, format string, a ...any)

PrintDebug prints a debug message to stdout if debug is enabled

func (*IOStreams) PrintError

func (io *IOStreams) PrintError(ctx context.Context, format string, a ...any)

PrintError logs and prints an error message to stderr

func (*IOStreams) PrintInfo

func (io *IOStreams) PrintInfo(ctx context.Context, shouldTrace bool, format string, a ...any)

PrintInfo print a formatted message to stdout, sometimes tracing context

func (*IOStreams) PrintTrace

func (io *IOStreams) PrintTrace(ctx context.Context, traceID string, traceValues ...string)

PrintTrace prints traceID and values to stdout if SLACK_TEST_TRACE=true

func (*IOStreams) PrintWarning

func (io *IOStreams) PrintWarning(ctx context.Context, format string, a ...any)

PrintWarning logs and prints a warning message to stdout

func (*IOStreams) ReadIn

func (io *IOStreams) ReadIn() io.Reader

ReadIn returns the reader associated with stdin

func (*IOStreams) SelectPrompt

func (io *IOStreams) SelectPrompt(ctx context.Context, msg string, options []string, cfg SelectPromptConfig) (SelectPromptResponse, error)

SelectPrompt prompts the user to make a selection and returns the choice

func (*IOStreams) SetCmdIO

func (io *IOStreams) SetCmdIO(cmd *cobra.Command)

SetCmdIO sets the Cobra command I/O to match the IOStream

func (*IOStreams) SetExitCode

func (io *IOStreams) SetExitCode(code ExitCode)

SetExitCode sets the desired exit code in a thread-safe way

func (*IOStreams) WriteDebug

func (io *IOStreams) WriteDebug(ctx context.Context) WriteDebugger

WriteDebug writes the debug message using the io.Writer implementation

func (*IOStreams) WriteErr

func (io *IOStreams) WriteErr() io.Writer

WriteErr returns the writer associated with stderr

func (*IOStreams) WriteIndent

func (io *IOStreams) WriteIndent(w io.Writer) WriteIndenter

WriteIndent writes messages in an indented format

func (*IOStreams) WriteOut

func (io *IOStreams) WriteOut() io.Writer

WriteOut returns the writer associated with stdout

func (*IOStreams) WriteSecondary

func (io *IOStreams) WriteSecondary(w io.Writer) WriteSecondarier

WriteSecondary writes messages in a dim and indented format for sections

type IOStreamsMock

type IOStreamsMock struct {
	mock.Mock

	Stdin  io.Reader
	Stdout *log.Logger

	Stderr *log.Logger
	// contains filtered or unexported fields
}

func NewIOStreamsMock

func NewIOStreamsMock(config *config.Config, fsm *slackdeps.FsMock, osm *slackdeps.OsMock) *IOStreamsMock

NewIOStreamsMock creates a new IOStream with buffers that can be read for tests.

func (*IOStreamsMock) AddDefaultMocks

func (m *IOStreamsMock) AddDefaultMocks()

AddDefaultMocks prepares default mock methods to fallback to

func (*IOStreamsMock) ConfirmPrompt

func (m *IOStreamsMock) ConfirmPrompt(ctx context.Context, message string, defaultValue bool) (bool, error)

ConfirmPrompt mocks the confirm prompt from go-survey

func (*IOStreamsMock) DumpLogs

func (m *IOStreamsMock) DumpLogs()

DumpLogs can sometimes be useful when debugging unit tests

func (*IOStreamsMock) FinishLogFile

func (m *IOStreamsMock) FinishLogFile(ctx context.Context)

FinishLogFile mocks ending the debug info to .slack/logs/slack-debug-[date].log with debug-ability data

func (*IOStreamsMock) FlushToLogFile

func (m *IOStreamsMock) FlushToLogFile(ctx context.Context, prefix, errStr string) error

func (*IOStreamsMock) GetExitCode

func (m *IOStreamsMock) GetExitCode() ExitCode

GetExitCode returns the most-recently set desired exit code in a thread safe way

func (*IOStreamsMock) InitLogFile

func (m *IOStreamsMock) InitLogFile(ctx context.Context) error

InitLogFile mocks starting the debug info to .slack/logs/slack-debug-[date].log with debug-ability data

func (*IOStreamsMock) InputPrompt

func (m *IOStreamsMock) InputPrompt(ctx context.Context, message string, cfg InputPromptConfig) (string, error)

InputPrompt mocks the input prompt from go-survey

func (*IOStreamsMock) IsTTY

func (m *IOStreamsMock) IsTTY() bool

func (*IOStreamsMock) MultiSelectPrompt

func (m *IOStreamsMock) MultiSelectPrompt(ctx context.Context, message string, options []string) ([]string, error)

SelectPrompt mocks the select prompt from go-survey

func (*IOStreamsMock) PasswordPrompt

func (m *IOStreamsMock) PasswordPrompt(ctx context.Context, message string, cfg PasswordPromptConfig) (PasswordPromptResponse, error)

PasswordPrompt mocks the password prompt or flag selection

func (*IOStreamsMock) PrintDebug

func (m *IOStreamsMock) PrintDebug(ctx context.Context, format string, a ...interface{})

PrintDebug mocks printing a message to stdout only when debug is enabled

func (*IOStreamsMock) PrintError

func (m *IOStreamsMock) PrintError(ctx context.Context, format string, a ...interface{})

PrintError mocks logging and printing an error message to stderr

func (*IOStreamsMock) PrintInfo

func (m *IOStreamsMock) PrintInfo(ctx context.Context, shouldTrace bool, format string, a ...interface{})

PrintInfo print a formatted message to stdout, sometimes tracing context

func (*IOStreamsMock) PrintTrace

func (m *IOStreamsMock) PrintTrace(ctx context.Context, traceID string, traceValues ...string)

PrintTrace mocks how traces are generated and printed, matching the actual implementation

func (*IOStreamsMock) PrintWarning

func (m *IOStreamsMock) PrintWarning(ctx context.Context, format string, a ...interface{})

PrintWarning falsely mocks logs and prints a warning message to stdout

func (*IOStreamsMock) ReadIn

func (m *IOStreamsMock) ReadIn() io.Reader

ReadIn returns the mocked reader associated with stdin

func (*IOStreamsMock) SelectPrompt

func (m *IOStreamsMock) SelectPrompt(ctx context.Context, message string, options []string, cfg SelectPromptConfig) (SelectPromptResponse, error)

SelectPrompt mocks the select prompt from go-survey

func (*IOStreamsMock) SetCmdIO

func (m *IOStreamsMock) SetCmdIO(cmd *cobra.Command)

SetCmdIO sets the Cobra command I/O to be the same as the IOStreamsMock

func (*IOStreamsMock) SetExitCode

func (m *IOStreamsMock) SetExitCode(code ExitCode)

SetExitCode sets the desired exit code in a thread-safe way

func (*IOStreamsMock) WriteDebug

func (m *IOStreamsMock) WriteDebug(ctx context.Context) WriteDebugger

WriteDebug implements the actual WriteDebug method with a mock call

func (*IOStreamsMock) WriteErr

func (m *IOStreamsMock) WriteErr() io.Writer

WriteErr returns the mocked writer associated with stderr

func (*IOStreamsMock) WriteIndent

func (m *IOStreamsMock) WriteIndent(w io.Writer) WriteIndenter

WriteIndent stubs the implementation and uses a default mock

func (*IOStreamsMock) WriteOut

func (m *IOStreamsMock) WriteOut() io.Writer

WriteOut returns the mocked writer associated with stdout

func (*IOStreamsMock) WriteSecondary

func (m *IOStreamsMock) WriteSecondary(w io.Writer) WriteSecondarier

WriteSecondary stubs the implementation and uses a default mock

type InputPromptConfig

type InputPromptConfig struct {
	Required bool // Whether the input must be non-empty
}

InputPromptConfig holds additional config for an Input prompt

func (InputPromptConfig) GetFlags

func (cfg InputPromptConfig) GetFlags() []*pflag.Flag

GetFlags returns all flags for the Input prompt

func (InputPromptConfig) IsRequired

func (cfg InputPromptConfig) IsRequired() bool

IsRequired returns if a response is required

type MultiSelectPromptConfig

type MultiSelectPromptConfig struct {
	Required bool // If a response is required
}

MultiSelectPromptConfig holds additional configs for a MultiSelect prompt

func (MultiSelectPromptConfig) GetFlags

func (cfg MultiSelectPromptConfig) GetFlags() []*pflag.Flag

GetFlags returns all flags for the MultiSelect prompt

func (MultiSelectPromptConfig) IsRequired

func (cfg MultiSelectPromptConfig) IsRequired() bool

IsRequired returns if a response is required

type PasswordPromptConfig

type PasswordPromptConfig struct {
	Flag     *pflag.Flag // The flag substitute for this prompt
	Required bool        // If a response is required
	Template string      // Custom formatting of the password prompt
}

PasswordPromptConfig holds additional config for a survey.Select prompt

func (PasswordPromptConfig) GetFlags

func (cfg PasswordPromptConfig) GetFlags() []*pflag.Flag

GetFlags returns all flags for the password prompt

func (PasswordPromptConfig) IsRequired

func (cfg PasswordPromptConfig) IsRequired() bool

IsRequired returns if a response is required

type PasswordPromptResponse

type PasswordPromptResponse struct {
	Value  string // The value of the response
	Flag   bool   // If a flag value was used
	Prompt bool   // If a survey input was provided
}

PasswordPromptResponse holds response information from a password prompt

type Printer

type Printer interface {
	// PrintDebug prints a debug message to stdout if debug is enabled
	PrintDebug(ctx context.Context, format string, a ...any)
	// PrintError logs and prints an error message to stderr
	PrintError(ctx context.Context, format string, a ...any)
	// PrintWarning logs and prints a warning message to stdout
	PrintWarning(ctx context.Context, format string, a ...any)
	// PrintInfo print a formatted message to stdout, sometimes tracing context
	PrintInfo(ctx context.Context, shouldTrace bool, format string, a ...any)
	// PrintTrace prints traceID and values to stdout if SLACK_TEST_TRACE=true
	//
	// Trace value definitions are listed in internal/slacktrace/slacktrace.go
	PrintTrace(ctx context.Context, traceID string, traceValues ...string)
}

Printer contains implementations of printers that output to the display or file

These are preferred methods of capturing printed text for mocking and testing

type PromptConfig

type PromptConfig interface {
	GetFlags() []*pflag.Flag // GetFlags returns all flags for the prompt
	IsRequired() bool        // IsRequired returns if a response must be provided
}

PromptConfig contains general information about a prompt

type Reader

type Reader interface {
	ReadIn() io.Reader
}

Reader contains implementations of a Read methods for various inputs methods

Only stdin is supported for now

type SelectPromptConfig

type SelectPromptConfig struct {
	Description func(value string, index int) string // Optional text displayed below each prompt option
	Flag        *pflag.Flag                          // The single flag substitute for this prompt
	Flags       []*pflag.Flag                        // Otherwise multiple flag substitutes for this prompt
	PageSize    int                                  // The number of options displayed before the user needs to scroll
	Required    bool                                 // If a response is required
	Template    string                               // Custom formatting of the selection prompt
}

SelectPromptConfig holds additional config for a survey.Select prompt

func DefaultSelectPromptConfig

func DefaultSelectPromptConfig() SelectPromptConfig

DefaultSelectPromptConfig returns default config object for a survey.Select prompt

func (SelectPromptConfig) GetFlags

func (cfg SelectPromptConfig) GetFlags() []*pflag.Flag

GetFlags returns all flags for the prompt

func (SelectPromptConfig) IsRequired

func (cfg SelectPromptConfig) IsRequired() bool

IsRequired returns if a response is required

type SelectPromptResponse

type SelectPromptResponse struct {
	Index  int    // The index of any selection
	Option string // The value of the response

	Flag   bool // If a flag value was used
	Prompt bool // If a survey selection was made
}

SelectPromptResponse holds response information from a selection prompt

type WriteDebugger

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

WriteDebugger contains information needed to write debug logs

func (WriteDebugger) Write

func (wr WriteDebugger) Write(p []byte) (n int, err error)

Write splits an input and writes debug logs line by line

type WriteIndenter

type WriteIndenter struct {
	Writer io.Writer
}

WriteIndenter contains information needed to write indented sections

func (WriteIndenter) Write

func (ws WriteIndenter) Write(p []byte) (n int, err error)

Write splits an input and writes indented lines to the writer

type WriteSecondarier

type WriteSecondarier struct {
	Writer io.Writer
}

WriteSecondarier contains information needed to write secondary text

func (WriteSecondarier) Write

func (ws WriteSecondarier) Write(p []byte) (n int, err error)

Write splits an input and writes formatted lines to the writer

type Writer

type Writer interface {
	// WriteOut returns the writer associated with stdout
	WriteOut() io.Writer
	// WriteErr returns the writer associated with stderr
	WriteErr() io.Writer

	// WriteDebug writes the debug message using the io.Writer implementation
	WriteDebug(context.Context) WriteDebugger

	// WriteIndent writes an indented message to the writer
	WriteIndent(io.Writer) WriteIndenter

	// WriteSecondary writes messages to the writer with secondary highlights
	WriteSecondary(io.Writer) WriteSecondarier
}

Writer contains implementions of io.Writer that log and output provided input

Used over Printer when the Write method is needed while still wanting to have outputs formatted and directed to the matching stream

Jump to

Keyboard shortcuts

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