console

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StderrStyles = sync.OnceValue(func() Styles {
	return MakeStyles(StderrRenderer())
})
View Source
var StdoutRenderer = sync.OnceValue(func() *lipgloss.Renderer {
	return lipgloss.DefaultRenderer()
})
View Source
var StdoutStyles = sync.OnceValue(func() Styles {
	return MakeStyles(StdoutRenderer())
})

Functions

func Error deprecated

func Error(args interface{})

Deprecated: uses console.StderrRenderer() Error handles and displays an error message. It formats the error message using the provided arguments.

func Errorf deprecated

func Errorf(format string, args ...interface{})

Deprecated: uses console.StderrRenderer() Errorf formats and displays an error message using the provided format string and arguments.

func Fatal deprecated

func Fatal(args interface{})

Deprecated: uses console.StderrRenderer() Fatal handles and displays a fatal error message. It then exits the program with a status code of 1.

func Fatalf deprecated

func Fatalf(format string, args ...interface{})

Deprecated: uses console.StderrRenderer() Fatalf formats and displays a fatal error message using the provided format string and arguments. It then exits the program with a status code of 1.

func Info

func Info(text string)

Info prints an informational message with the defined style.

func Infof

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

Infof formats and prints an informational message with the defined style.

func MakeGradientRamp

func MakeGradientRamp(length int) []lipgloss.Color

func MakeGradientText

func MakeGradientText(baseStyle lipgloss.Style, str string) string

func NewAnim

func NewAnim(cyclingCharsSize uint, label string, r *lipgloss.Renderer, s Styles) anim

func NewPrompt

func NewPrompt(prefix string, enableColor bool, completer prompt.Completer, exec func(string)) *prompt.Prompt

func PrintConfirmation

func PrintConfirmation(action, content string)

func Render

func Render(format string, args ...interface{})

func RenderAppName

func RenderAppName(appName string, suffix string, args ...interface{})

func RenderError

func RenderError(err error, reason string, args ...interface{})

func RenderStep

func RenderStep(format string, args ...interface{})

RenderStep renders commit process step messages with a prefix

func RenderSuccess

func RenderSuccess(format string, args ...interface{})

RenderSuccess renders successful commit messages

func Success

func Success(text string)

Success prints a bold green success message with top padding. The message is styled with a green foreground color (terminal color 2) and bold text. Example usage: console.Success("Operation completed successfully")

func Successf

func Successf(format string, args ...interface{})

Successf prints a formatted bold green success message with top padding. Uses fmt.Sprintf syntax for formatting and applies the same styling as Success. Example usage: console.Successf("Successfully processed %d items", count)

func WaitForUserConfirm

func WaitForUserConfirm(defaultVal confirmation.Value, format string, args ...interface{}) bool

func Warn

func Warn(text string)

Warn prints the given text with a warning style.

func Warnf

func Warnf(format string, args ...interface{})

Warnf prints the formatted string with a warning style.

Types

type Styles

type Styles struct {
	AppName,
	CliArgs,
	Comment,
	CyclingChars,
	ErrorHeader,
	ErrorDetails,
	ErrPadding,
	Flag,
	FlagComma,
	FlagDesc,
	InlineCode,
	Link,
	Pipe,
	Quote,
	ConversationList,
	SHA1,
	Timeago,
	CommitStep,
	CommitSuccess,
	DiffHeader,
	DiffFileHeader,
	DiffHunkHeader,
	DiffAdded,
	DiffRemoved,
	DiffContext lipgloss.Style
}

func MakeStyles

func MakeStyles(r *lipgloss.Renderer) (s Styles)

Jump to

Keyboard shortcuts

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