ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Messenger

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

Messenger is a generic logger that prefixes lines with status icons.

func NewMessenger

func NewMessenger(ios *ioutil.IOStreams) *Messenger

NewMessenger returns a new IconLogger.

func (*Messenger) Failure

func (m *Messenger) Failure(line string, args ...any)

Failure prints line to StdOut prefixed with "✖".

func (*Messenger) FailureErr

func (m *Messenger) FailureErr(line string, args ...any)

FailureErr prints line to StdErr prefixed with "✖".

func (*Messenger) FailureTag

func (m *Messenger) FailureTag(tag string, line string, args ...any)

FailureTag prints line to StdOut prefixed with "✖ [tag] ".

func (*Messenger) FailureTagErr

func (m *Messenger) FailureTagErr(tag string, line string, args ...any)

FailureTagErr prints line to StdErr prefixed with "✖ [tag] ".

func (*Messenger) Info

func (m *Messenger) Info(line string, args ...any)

Info prints line to StdOut prefixed with "•".

func (*Messenger) InfoErr

func (m *Messenger) InfoErr(line string, args ...any)

InfoErr prints line to StdErr prefixed with "•".

func (*Messenger) InfoTag

func (m *Messenger) InfoTag(tag string, line string, args ...any)

InfoTag prints line to StdOut prefixed with "• [tag] ".

func (*Messenger) InfoTagErr

func (m *Messenger) InfoTagErr(tag string, line string, args ...any)

InfoTagErr prints line to StdErr prefixed with "• [tag] ".

func (*Messenger) Success

func (m *Messenger) Success(line string, args ...any)

Success prints line to StdOut prefixed with "✓".

func (*Messenger) SuccessErr

func (m *Messenger) SuccessErr(line string, args ...any)

SuccessErr prints line to StdErr prefixed with "✓".

func (*Messenger) SuccessTag

func (m *Messenger) SuccessTag(tag string, line string, args ...any)

SuccessTag prints line to StdOut prefixed with "✓ [tag] ".

func (*Messenger) SuccessTagErr

func (m *Messenger) SuccessTagErr(tag string, line string, args ...any)

SuccessTagErr prints line to StdErr prefixed with "✓ [tag] ".

func (*Messenger) Warning

func (m *Messenger) Warning(line string, args ...any)

Warning prints line to StdOut prefixed with "!".

func (*Messenger) WarningErr

func (m *Messenger) WarningErr(line string, args ...any)

WarningErr prints line to StdErr prefixed with "!".

func (*Messenger) WarningTag

func (m *Messenger) WarningTag(tag string, line string, args ...any)

WarningTag prints line to StdOut prefixed with "! [tag] ".

func (*Messenger) WarningTagErr

func (m *Messenger) WarningTagErr(tag string, line string, args ...any)

WarningTagErr prints line to StdOut prefixed with "! [tag] ".

type Prompter

type Prompter interface {
	// Confirm prompts for a boolean yes/no value.
	Confirm(msg string, value bool, help string) (bool, error)
	// Input prompts for single string value.
	Input(msg string, value string, help string) (string, error)
	// MultiSelect prompts for a slice of string values w/ a fixed set of options.
	MultiSelect(msg string, options []string, values []string, help string) ([]string, error)
	// Select prompts for single string value w/ a fixed set of options.
	Select(msg string, options []string, value string, help string) (string, error)
}

Prompter is an interface for types that prompt for user input.

type SurveyPrompter

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

SurveyPrompter is a light wrapper around the survey(https://github.com/go-survey/survey) library.

func NewSurveyPrompter

func NewSurveyPrompter(in fileReader, out fileWriter, err fileWriter, s session) *SurveyPrompter

func (*SurveyPrompter) Confirm

func (p *SurveyPrompter) Confirm(prompt string, defaultValue bool, help string) (bool, error)

Confirm prompts for a boolean yes/no value.

func (*SurveyPrompter) Input

func (p *SurveyPrompter) Input(prompt string, defaultValue string, help string) (string, error)

Input prompts for single string value.

func (*SurveyPrompter) MultiSelect

func (p *SurveyPrompter) MultiSelect(
	prompt string, options []string, defaultValues []string, help string,
) ([]string, error)

MultiSelect prompts for a slice of string values w/ a fixed set of options.

func (*SurveyPrompter) Select

func (p *SurveyPrompter) Select(
	prompt string, options []string, defaultValue string, help string,
) (string, error)

Select prompts for single string value w/ a fixed set of options.

Jump to

Keyboard shortcuts

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