cli

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ColorReset  = "\033[0m"
	ColorRed    = "\033[31m"
	ColorGreen  = "\033[32m"
	ColorYellow = "\033[33m"
	ColorBlue   = "\033[34m"
	ColorPurple = "\033[35m"
	ColorCyan   = "\033[36m"
	ColorWhite  = "\033[37m"
	ColorGray   = "\033[90m"

	ColorBold      = "\033[1m"
	ColorUnderline = "\033[4m"
)

Color codes for terminal output

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiProgress

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

MultiProgress manages multiple progress indicators

func NewMultiProgress

func NewMultiProgress() *MultiProgress

NewMultiProgress creates a new multi-progress manager

func (*MultiProgress) AddProgress

func (m *MultiProgress) AddProgress(total int, message string) *ProgressIndicator

AddProgress adds a progress indicator

func (*MultiProgress) AddSpinner

func (m *MultiProgress) AddSpinner(message string) *Spinner

AddSpinner adds a spinner

func (*MultiProgress) StopAll

func (m *MultiProgress) StopAll()

StopAll stops all progress indicators and spinners

type OutputFormat

type OutputFormat string

OutputFormat defines the output format type

const (
	FormatTable OutputFormat = "table"
	FormatJSON  OutputFormat = "json"
	FormatYAML  OutputFormat = "yaml"
	FormatTree  OutputFormat = "tree"
	FormatPlain OutputFormat = "plain"
)

type OutputFormatter

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

OutputFormatter handles formatted output

func NewOutputFormatter

func NewOutputFormatter() *OutputFormatter

NewOutputFormatter creates a new output formatter

func (*OutputFormatter) Box

func (f *OutputFormatter) Box(title, content string)

Box prints text in a box

func (*OutputFormatter) Color

func (f *OutputFormatter) Color(text, color string) string

Color returns colored string if color is enabled

func (*OutputFormatter) DisableColor

func (f *OutputFormatter) DisableColor()

DisableColor disables colored output

func (*OutputFormatter) Error

func (f *OutputFormatter) Error(message string, args ...interface{})

Error prints an error message

func (*OutputFormatter) Header

func (f *OutputFormatter) Header(text string)

Header prints a header

func (*OutputFormatter) Info

func (f *OutputFormatter) Info(message string, args ...interface{})

Info prints an info message

func (*OutputFormatter) KeyValue

func (f *OutputFormatter) KeyValue(key, value string)

KeyValue prints a key-value pair

func (*OutputFormatter) KeyValueList

func (f *OutputFormatter) KeyValueList(items map[string]string)

KeyValueList prints a list of key-value pairs

func (*OutputFormatter) List

func (f *OutputFormatter) List(items []string)

List prints a list with bullets

func (*OutputFormatter) NumberedList

func (f *OutputFormatter) NumberedList(items []string)

NumberedList prints a numbered list

func (*OutputFormatter) ProgressBar

func (f *OutputFormatter) ProgressBar(current, total int, width int)

ProgressBar prints a simple progress bar

func (*OutputFormatter) Section

func (f *OutputFormatter) Section(text string)

Section prints a section header

func (*OutputFormatter) SetFormat

func (f *OutputFormatter) SetFormat(format OutputFormat)

SetFormat sets the output format

func (*OutputFormatter) StatusIcon

func (f *OutputFormatter) StatusIcon(status string) string

StatusIcon returns an appropriate status icon

func (*OutputFormatter) Success

func (f *OutputFormatter) Success(message string, args ...interface{})

Success prints a success message

func (*OutputFormatter) Table

func (f *OutputFormatter) Table(headers []string, rows [][]string)

Table prints data in table format

func (*OutputFormatter) Tree

func (f *OutputFormatter) Tree(root TreeNode)

Tree prints data in tree format

func (*OutputFormatter) Warning

func (f *OutputFormatter) Warning(message string, args ...interface{})

Warning prints a warning message

type ProgressIndicator

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

ProgressIndicator provides visual feedback during long-running operations

func NewProgressIndicator

func NewProgressIndicator(total int, message string) *ProgressIndicator

NewProgressIndicator creates a new progress indicator

func (*ProgressIndicator) Complete

func (p *ProgressIndicator) Complete()

Complete marks the progress as complete

func (*ProgressIndicator) Increment

func (p *ProgressIndicator) Increment()

Increment increments the progress by 1

func (*ProgressIndicator) SetMessage

func (p *ProgressIndicator) SetMessage(message string)

SetMessage updates the progress message

func (*ProgressIndicator) Start

func (p *ProgressIndicator) Start()

Start begins the progress display

func (*ProgressIndicator) Update

func (p *ProgressIndicator) Update(current int)

Update updates the current progress

type Prompt

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

Prompt provides interactive prompting capabilities

func NewPrompt

func NewPrompt() *Prompt

NewPrompt creates a new prompt

func (*Prompt) Confirm

func (p *Prompt) Confirm(message string, defaultYes bool) bool

Confirm asks for yes/no confirmation

func (*Prompt) ConfirmDangerous

func (p *Prompt) ConfirmDangerous(operation string, resources []string) bool

ConfirmDangerous asks for confirmation of dangerous operations

func (*Prompt) ConfirmWithDetails

func (p *Prompt) ConfirmWithDetails(message string, details []string) bool

ConfirmWithDetails asks for confirmation with additional details

func (*Prompt) Input

func (p *Prompt) Input(message string, defaultValue string) (string, error)

Input asks for text input

func (*Prompt) MultiSelect

func (p *Prompt) MultiSelect(message string, options []string) ([]int, error)

MultiSelect asks the user to select multiple options

func (*Prompt) Password

func (p *Prompt) Password(message string) (string, error)

Password asks for password input (Note: input will be visible)

func (*Prompt) Select

func (p *Prompt) Select(message string, options []string) (int, error)

Select asks the user to select from a list of options

func (*Prompt) SelectWithFilter

func (p *Prompt) SelectWithFilter(message string, options []string) (int, error)

SelectWithFilter allows filtering of options

func (*Prompt) TableSelect

func (p *Prompt) TableSelect(message string, headers []string, rows [][]string) (int, error)

TableSelect shows options in a table and allows selection

type SimpleTreeNode

type SimpleTreeNode struct {
	Name     string
	Children []TreeNode
}

SimpleTreeNode is a basic implementation of TreeNode

func (SimpleTreeNode) GetChildren

func (n SimpleTreeNode) GetChildren() []TreeNode

func (SimpleTreeNode) GetName

func (n SimpleTreeNode) GetName() string

type Spinner

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

Spinner provides an animated spinner for indeterminate operations

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner

func (*Spinner) Error

func (s *Spinner) Error(message string)

Error stops the spinner with an error message

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(message string)

SetMessage updates the spinner message

func (*Spinner) Start

func (s *Spinner) Start()

Start begins the spinner animation

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner

func (*Spinner) Success

func (s *Spinner) Success(message string)

Success stops the spinner with a success message

type TreeNode

type TreeNode interface {
	GetName() string
	GetChildren() []TreeNode
}

TreeNode interface for tree printing

Jump to

Keyboard shortcuts

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