uxBlock

package
v1.0.42 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package uxBlock provides building blocks for UX and communication with a user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocks added in v1.0.38

type Blocks struct {
	TerminalWidth  int
	TerminalHeight int
	// contains filtered or unexported fields
}

func NewBlocks added in v1.0.38

func NewBlocks(
	outputLogger logger.Logger,
	debugFileLogger logger.Logger,
	isTerminal bool,
	terminalWidth int,
	terminalHeight int,
	ctxCancel context.CancelFunc,
) *Blocks

func (*Blocks) GetDebugFileLogger added in v1.0.40

func (b *Blocks) GetDebugFileLogger() logger.Logger

func (*Blocks) GetOutputLogger added in v1.0.40

func (b *Blocks) GetOutputLogger() logger.Logger

func (*Blocks) LogDebug added in v1.0.38

func (b *Blocks) LogDebug(message string)

func (*Blocks) PrintError added in v1.0.38

func (b *Blocks) PrintError(line styles.Line)

func (*Blocks) PrintInfo added in v1.0.38

func (b *Blocks) PrintInfo(line styles.Line)

func (*Blocks) PrintWarning added in v1.0.38

func (b *Blocks) PrintWarning(line styles.Line)

func (*Blocks) Prompt added in v1.0.38

func (b *Blocks) Prompt(
	ctx context.Context,
	message string,
	choices []string,
	auxOptions ...PromptOption,
) (int, error)

func (*Blocks) RunSpinners added in v1.0.38

func (b *Blocks) RunSpinners(ctx context.Context, spinners []*Spinner) func()

func (*Blocks) Select added in v1.0.38

func (b *Blocks) Select(ctx context.Context, tableBody *TableBody, auxOptions ...SelectOption) ([]int, error)

func (*Blocks) Table added in v1.0.38

func (b *Blocks) Table(body *TableBody, auxOptions ...TableOption)

type PromptOption

type PromptOption = func(cfg *promptConfig)

type SelectOption

type SelectOption = func(cfg *selectConfig)

func SelectEnableMultiSelect

func SelectEnableMultiSelect() SelectOption

func SelectLabel

func SelectLabel(label string) SelectOption

func SelectTableHeader

func SelectTableHeader(header *TableRow) SelectOption

type Spinner

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

func NewSpinner

func NewSpinner(line styles.Line, width, height int) *Spinner

func (*Spinner) Finish

func (s *Spinner) Finish(text styles.Line) *Spinner

func (*Spinner) FinishWithError added in v1.0.38

func (s *Spinner) FinishWithError(text styles.Line) *Spinner

func (*Spinner) LogView added in v1.0.38

func (s *Spinner) LogView() io.WriteCloser

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(text styles.Line) *Spinner

type TableBody

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

func NewTableBody

func NewTableBody() *TableBody

func (*TableBody) AddRow

func (b *TableBody) AddRow(row *TableRow)

func (*TableBody) AddStringsRow

func (b *TableBody) AddStringsRow(cells ...string) *TableBody

func (*TableBody) AddStringsRows

func (b *TableBody) AddStringsRows(rows ...[]string) *TableBody

type TableCell

type TableCell struct {
	Text string
}

func NewTableCell

func NewTableCell(text string) *TableCell

type TableOption

type TableOption = func(cfg *tableConfig)

func WithTableHeader

func WithTableHeader(header *TableRow) TableOption

type TableRow

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

func NewTableRow

func NewTableRow() *TableRow

func (*TableRow) AddCell

func (r *TableRow) AddCell(cell *TableCell) *TableRow

func (*TableRow) AddStringCell

func (r *TableRow) AddStringCell(text string) *TableRow

func (*TableRow) AddStringCells

func (r *TableRow) AddStringCells(cells ...string) *TableRow

type UxBlocks

type UxBlocks interface {
	GetOutputLogger() logger.Logger
	GetDebugFileLogger() logger.Logger
	LogDebug(message string)
	PrintInfo(line styles.Line)
	PrintWarning(line styles.Line)
	PrintError(line styles.Line)
	Table(body *TableBody, auxOptions ...TableOption)
	Select(ctx context.Context, tableBody *TableBody, auxOptions ...SelectOption) ([]int, error)
	Prompt(
		ctx context.Context,
		message string,
		choices []string,
		auxOptions ...PromptOption,
	) (int, error)
	RunSpinners(ctx context.Context, spinners []*Spinner) func()
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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