terminal

package
v0.0.0-...-078a86d Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Green  = color.New(color.FgGreen).SprintFunc()
	Yellow = color.New(color.FgYellow).SprintFunc()
	Red    = color.New(color.FgRed).SprintFunc()
	Blue   = color.New(color.FgBlue).SprintFunc()

	BlueBoldUnderline  = color.New(color.FgBlue, color.Bold, color.Underline).SprintFunc()
	WhiteBoldUnderline = color.New(color.FgWhite, color.Bold, color.Underline).SprintFunc()
)

Colors for terminal output.

Functions

func ErrorMessage

func ErrorMessage(message string, err error)

ErrorMessage prints an error message with a red "[Error]" prefix.

func InputWithDefaultValue

func InputWithDefaultValue(scanner *bufio.Scanner, message, defaultValue string) string

InputWithDefaultValue prompts the user for input via terminal and returns the input value or the default value.

func Message

func Message(message string)

Message prints a message with no prefix.

func Messagef

func Messagef(format string, a ...interface{})

Messagef prints a formatted message with no prefix.

func OKMessage

func OKMessage(message string)

OKMessage prints a success message with a green "[OK]" prefix.

func SetCmd

func SetCmd(newCommand *cobra.Command)

SetCmd sets the current command, allowing messages to be printed to the command's output using cmd.Print().

func SetTestMode

func SetTestMode(newTestBuffer *bytes.Buffer)

SetTestMode sets the terminal to test mode, allowing messages to be printed to a buffer.

func WarningMessage

func WarningMessage(message string)

WarningMessage prints a warning message with a yellow "[Warning]" prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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