cli

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cli provides CLI enhancement utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StandardAliases

func StandardAliases() map[string]string

StandardAliases returns standard command aliases

func StandardThemes

func StandardThemes() map[string]ColorTheme

StandardThemes returns standard color themes

Types

type AliasManager

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

AliasManager manages command aliases

func NewAliasManager

func NewAliasManager() *AliasManager

NewAliasManager creates a new alias manager

func (*AliasManager) AddAlias

func (am *AliasManager) AddAlias(alias, command string)

AddAlias adds a command alias

func (*AliasManager) ListAliases

func (am *AliasManager) ListAliases() map[string]string

ListAliases returns all aliases

func (*AliasManager) ResolveAlias

func (am *AliasManager) ResolveAlias(input string) string

ResolveAlias resolves an alias to a command

type BatchItem

type BatchItem struct {
	ID      string
	Action  string
	Payload interface{}
}

BatchItem represents an item in a batch

type BatchOperation

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

BatchOperation enables batch operations

func NewBatchOperation

func NewBatchOperation(parallel int, onError ErrorHandling) *BatchOperation

NewBatchOperation creates a new batch operation

func (*BatchOperation) AddItem

func (bo *BatchOperation) AddItem(item BatchItem)

AddItem adds an item to the batch

func (*BatchOperation) Execute

func (bo *BatchOperation) Execute() []BatchResult

Execute executes the batch operation

type BatchResult

type BatchResult struct {
	ID      string
	Success bool
	Error   error
}

BatchResult represents a batch operation result

type ChainCommand

type ChainCommand struct {
	Command     string
	Args        []string
	OnSuccess   bool
	OnFailure   bool
	Description string
}

ChainCommand represents a command in a chain

type ColorTheme

type ColorTheme struct {
	Name       string
	Primary    string
	Secondary  string
	Success    string
	Warning    string
	Error      string
	Info       string
	Background string
}

ColorTheme defines a color theme for the CLI

type CommandChain

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

CommandChain enables command chaining

func NewCommandChain

func NewCommandChain() *CommandChain

NewCommandChain creates a new command chain

func (*CommandChain) AddCommand

func (cc *CommandChain) AddCommand(cmd ChainCommand)

AddCommand adds a command to the chain

func (*CommandChain) Execute

func (cc *CommandChain) Execute() error

Execute executes the command chain

type CommandInfo

type CommandInfo struct {
	Name        string
	Description string
	Aliases     []string
}

CommandInfo represents command information for completion

type DryRunAction

type DryRunAction struct {
	Type        string
	Description string
	Parameters  map[string]interface{}
}

DryRunAction represents a dry-run action

type DryRunMode

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

DryRunMode enables dry-run mode for operations

func NewDryRunMode

func NewDryRunMode(enabled bool) *DryRunMode

NewDryRunMode creates a new dry-run mode

func (*DryRunMode) GetActions

func (d *DryRunMode) GetActions() []DryRunAction

GetActions returns recorded actions

func (*DryRunMode) IsEnabled

func (d *DryRunMode) IsEnabled() bool

IsEnabled returns if dry-run is enabled

func (*DryRunMode) PrintActions

func (d *DryRunMode) PrintActions()

PrintActions prints all recorded actions

func (*DryRunMode) Record

func (d *DryRunMode) Record(action DryRunAction)

Record records an action

type ErrorHandling

type ErrorHandling string

ErrorHandling defines how to handle errors in batch

const (
	ErrorHandlingContinue ErrorHandling = "continue"
	ErrorHandlingStop     ErrorHandling = "stop"
	ErrorHandlingRetry    ErrorHandling = "retry"
)

type ProgressIndicator

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

ProgressIndicator shows progress for long operations

func NewProgressIndicator

func NewProgressIndicator(total int, prefix string) *ProgressIndicator

NewProgressIndicator creates a new progress indicator

func (*ProgressIndicator) Complete

func (pi *ProgressIndicator) Complete()

Complete marks progress as complete

func (*ProgressIndicator) Update

func (pi *ProgressIndicator) Update(current int)

Update updates progress

type ShellCompletion

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

ShellCompletion generates shell completion scripts

func NewShellCompletion

func NewShellCompletion(shell string) *ShellCompletion

NewShellCompletion creates a new shell completion generator

func (*ShellCompletion) Generate

func (sc *ShellCompletion) Generate(commands []CommandInfo) (string, error)

Generate generates completion script

type Spinner

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

Spinner shows a spinning indicator

func NewSpinner

func NewSpinner(message string) *Spinner

NewSpinner creates a new spinner

func (*Spinner) Start

func (s *Spinner) Start()

Start starts the spinner

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner

Jump to

Keyboard shortcuts

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