Documentation
¶
Overview ¶
Package cli provides CLI enhancement utilities
Index ¶
- func StandardAliases() map[string]string
- func StandardThemes() map[string]ColorTheme
- type AliasManager
- type BatchItem
- type BatchOperation
- type BatchResult
- type ChainCommand
- type ColorTheme
- type CommandChain
- type CommandInfo
- type DryRunAction
- type DryRunMode
- type ErrorHandling
- type ProgressIndicator
- type ShellCompletion
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardAliases ¶
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 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 ¶
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 ¶
CommandInfo represents command information for completion
type DryRunAction ¶
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