ui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLine

func ClearLine()

ClearLine clears the current line in the terminal

func Confirm

func Confirm(message string) bool

Confirm prompts the user for a yes/no confirmation

func MoveCursorDown

func MoveCursorDown(lines int)

MoveCursorDown moves the cursor down by the specified number of lines

func MoveCursorUp

func MoveCursorUp(lines int)

MoveCursorUp moves the cursor up by the specified number of lines

func PromptMultiSelect

func PromptMultiSelect(message string, options []string) []string

PromptMultiSelect prompts the user to select multiple options

func PromptPassword

func PromptPassword(message string) string

PromptPassword prompts the user for a password (input is hidden) Note: This is a basic implementation. For production use, consider using a library like golang.org/x/term for proper password input handling

func PromptSelect

func PromptSelect(message string, options []string) string

PromptSelect prompts the user to select from a list of options

func PromptSelectIndex

func PromptSelectIndex(message string, options []string) int

PromptSelectIndex prompts the user to select from a list and returns the index

func PromptString

func PromptString(message string) string

PromptString prompts the user for a string input

func PromptStringWithDefault

func PromptStringWithDefault(message, defaultValue string) string

PromptStringWithDefault prompts the user for a string input with a default value

func ShowProgress

func ShowProgress(current, total int, message string)

ShowProgress displays a simple progress indicator

Types

type ProgressTracker

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

ProgressTracker tracks progress of multi-step operations

func NewProgressTracker

func NewProgressTracker(title string) *ProgressTracker

NewProgressTracker creates a new progress tracker

func (*ProgressTracker) AddStep

func (pt *ProgressTracker) AddStep(id, description string)

AddStep adds a new step to the tracker

func (*ProgressTracker) CompleteStep

func (pt *ProgressTracker) CompleteStep(id string)

CompleteStep marks a step as completed

func (*ProgressTracker) FailStep

func (pt *ProgressTracker) FailStep(id, error string)

FailStep marks a step as failed

func (*ProgressTracker) GetSummary

func (pt *ProgressTracker) GetSummary() string

GetSummary returns a summary of the progress

func (*ProgressTracker) HasFailed

func (pt *ProgressTracker) HasFailed() bool

HasFailed returns true if any step has failed

func (*ProgressTracker) IsCompleted

func (pt *ProgressTracker) IsCompleted() bool

IsCompleted returns true if all steps are completed or skipped

func (*ProgressTracker) SkipStep

func (pt *ProgressTracker) SkipStep(id, reason string)

SkipStep marks a step as skipped

func (*ProgressTracker) Start

func (pt *ProgressTracker) Start()

Start begins progress tracking

func (*ProgressTracker) StartStep

func (pt *ProgressTracker) StartStep(id string)

StartStep marks a step as running

func (*ProgressTracker) Stop

func (pt *ProgressTracker) Stop()

Stop ends progress tracking

type Step

type Step struct {
	ID          string
	Description string
	Status      StepStatus
	Detail      string
	StartTime   time.Time
	EndTime     time.Time
}

Step represents a single step in a progress tracker

type StepStatus

type StepStatus int

StepStatus represents the status of a step

const (
	StepStatusPending StepStatus = iota
	StepStatusRunning
	StepStatusCompleted
	StepStatusSkipped
	StepStatusFailed
)

func (StepStatus) String

func (s StepStatus) String() string

String returns a string representation of the step status

Jump to

Keyboard shortcuts

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