ui

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ui provides console interaction utilities with styled output. It wraps terminal operations with colored frames and user prompts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Console

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

func NewConsole

func NewConsole(opts ...Option) *Console

NewConsole creates a new Console with the given options.

func NewDefaultConsole added in v0.1.30

func NewDefaultConsole(ctx context.Context, f func(error)) *Console

func (*Console) Choose

func (c *Console) Choose(q string, opts []string, def string) (string, error)

func (*Console) ClearLine

func (c *Console) ClearLine(n int)

func (*Console) Confirm

func (c *Console) Confirm(q, def string) bool

func (*Console) ConfirmErr

func (c *Console) ConfirmErr(q, def string) error

ConfirmErr prompts the user with a question and options.

func (*Console) Error

func (c *Console) Error(s string) *frame.Frame

func (*Console) ErrorMesg

func (c *Console) ErrorMesg(a ...any) string

ErrorMesg returns a prettified error message.

func (*Console) Flush added in v0.1.30

func (c *Console) Flush() *frame.Frame

func (*Console) Frame added in v0.1.30

func (c *Console) Frame() *frame.Frame

func (*Console) Info

func (c *Console) Info(s string) *frame.Frame

func (*Console) InfoMesg

func (c *Console) InfoMesg(a ...any) string

InfoMesg returns a prettified info message.

func (*Console) Input

func (c *Console) Input(p string) string

func (*Console) InputPassword

func (c *Console) InputPassword(s string) (string, error)

func (*Console) Palette added in v0.1.30

func (c *Console) Palette() *ansi.Palette

func (*Console) Prompt

func (c *Console) Prompt(p string) string

Prompt get the input data from the user and return it.

func (*Console) PromptWithSuggestions

func (c *Console) PromptWithSuggestions(p string, items []string) string

func (*Console) ReplaceLine

func (c *Console) ReplaceLine(s string)

func (*Console) ReplaceLines

func (c *Console) ReplaceLines(n int, s string)

func (*Console) Reset added in v0.1.30

func (c *Console) Reset() *frame.Frame

func (*Console) SetReader

func (c *Console) SetReader(r io.Reader)

func (*Console) SetWriter

func (c *Console) SetWriter(w io.Writer)

func (*Console) Success

func (c *Console) Success(s string) *frame.Frame

func (*Console) SuccessMesg

func (c *Console) SuccessMesg(a ...any) string

SuccessMesg returns a prettified success message.

func (*Console) Term added in v0.1.30

func (c *Console) Term() *terminal.Term

func (*Console) Warning

func (c *Console) Warning(s string) *frame.Frame

func (*Console) WarningMesg

func (c *Console) WarningMesg(a ...any) string

WarningMesg returns a prettified warning message.

func (*Console) Writer added in v0.1.30

func (c *Console) Writer() io.Writer

type Option added in v0.1.30

type Option func(*Console)

Option is a function type for configuring Console.

func WithDefaultTerminal added in v0.1.30

func WithDefaultTerminal(ctx context.Context, f func(error)) Option

func WithFrame

func WithFrame(f *frame.Frame) Option

WithFrame sets a custom frame.

func WithTerminal

func WithTerminal(t *terminal.Term) Option

WithTerminal sets a custom terminal.

func WithWriter added in v0.1.30

func WithWriter(w io.Writer) Option

Directories

Path Synopsis
Package frame provides a customizable text framing and styling utility for console output, including borders and icons.
Package frame provides a customizable text framing and styling utility for console output, including borders and icons.
Package menu provides a flexible wrapper for the fzf interactive filter, enabling customizable selection menus.
Package menu provides a flexible wrapper for the fzf interactive filter, enabling customizable selection menus.
Package printer provides functions to format and print bookmark data, including records, tags, and repository information.
Package printer provides functions to format and print bookmark data, including records, tags, and repository information.
Package txt provides text formatting helpers.
Package txt provides text formatting helpers.

Jump to

Keyboard shortcuts

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