Documentation
¶
Index ¶
- func FormatDuration(d time.Duration) string
- func GetTerminalSize() (width, height int, err error)
- func IsTerminal(fd int) bool
- func ParsePortRange(portRange string) ([]int, error)
- func ShellSyntaxHighlighter(input string) string
- type CompletionResult
- type EditMode
- type Editor
- func (e *Editor) AcceptAutoSuggestion()
- func (e *Editor) AcceptAutoSuggestionWord()
- func (e *Editor) AddAlias(alias, command string)
- func (e *Editor) AddCompletion(word string)
- func (e *Editor) AddFilter(filter Filter)
- func (e *Editor) AddHistoryEntry(entry string)
- func (e *Editor) AddToKillRing(text string)
- func (e *Editor) CapitalizeWord()
- func (e *Editor) ClearHistory()
- func (e *Editor) CopyRegion()
- func (e *Editor) EnableAutoSuggestion(enabled bool)
- func (e *Editor) EnableBracketMatching(enabled bool)
- func (e *Editor) EnableMultiLine(enabled bool)
- func (e *Editor) EndMacro()
- func (e *Editor) GetAliases() map[string]string
- func (e *Editor) GetHistory() []string
- func (e *Editor) GetSelection() string
- func (e *Editor) IncrementalSearch(forward bool)
- func (e *Editor) KillRegion()
- func (e *Editor) LowercaseWord()
- func (e *Editor) PlayMacro(key rune)
- func (e *Editor) Readline() (string, error)
- func (e *Editor) Redo()
- func (e *Editor) RemoveAlias(alias string)
- func (e *Editor) SetCompletionFunction(fn func(string) []string)
- func (e *Editor) SetCompletions(words []string)
- func (e *Editor) SetEditMode(mode EditMode)
- func (e *Editor) SetEmacsMode()
- func (e *Editor) SetHintFunction(fn func(string) string)
- func (e *Editor) SetHistoryFile(path string)
- func (e *Editor) SetIgnoreCase(ignore bool)
- func (e *Editor) SetMark()
- func (e *Editor) SetMaxHistory(max int)
- func (e *Editor) SetPrompt(prompt string)
- func (e *Editor) SetPromptColor(enabled bool, c *color.Color)
- func (e *Editor) SetSyntaxHighlighter(fn SyntaxHighlighter)
- func (e *Editor) SetValidator(fn func(string) bool)
- func (e *Editor) SetViMode()
- func (e *Editor) SetWordBreakChars(chars string)
- func (e *Editor) StartMacro(key rune)
- func (e *Editor) TransposeChars()
- func (e *Editor) TransposeWords()
- func (e *Editor) Undo()
- func (e *Editor) UppercaseWord()
- func (e *Editor) ViModeIndicator() string
- func (e *Editor) YankFromKillRing()
- func (e *Editor) YankPop()
- type Filter
- type PasswordFilter
- type SyntaxHighlighter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶
FormatDuration formats a duration for display
func GetTerminalSize ¶
GetTerminalSize returns the current terminal size
func IsTerminal ¶
IsTerminal checks if the given file descriptor is a terminal
func ParsePortRange ¶
ParsePortRange parses a port range string like "80-443" or "22,80,443"
func ShellSyntaxHighlighter ¶
ShellSyntaxHighlighter provides syntax highlighting for shell commands
Types ¶
type CompletionResult ¶
CompletionResult represents a completion match
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor represents a readline editor with rlwrap-like features
func NewEditor ¶
func NewEditor() *Editor
NewEditor creates a new readline editor with rlwrap-like features
func (*Editor) AcceptAutoSuggestion ¶
func (e *Editor) AcceptAutoSuggestion()
AcceptAutoSuggestion accepts the current auto-suggestion
func (*Editor) AcceptAutoSuggestionWord ¶
func (e *Editor) AcceptAutoSuggestionWord()
AcceptAutoSuggestionWord accepts one word from auto-suggestion
func (*Editor) AddCompletion ¶
AddCompletion adds a static completion word
func (*Editor) AddHistoryEntry ¶
AddHistoryEntry adds a command to history with deduplication
func (*Editor) AddToKillRing ¶
AddToKillRing adds text to the kill ring
func (*Editor) ClearHistory ¶
func (e *Editor) ClearHistory()
ClearHistory clears the command history
func (*Editor) CopyRegion ¶
func (e *Editor) CopyRegion()
CopyRegion copies selected text to kill ring
func (*Editor) EnableAutoSuggestion ¶
EnableAutoSuggestion enables fish-like auto-suggestions from history
func (*Editor) EnableBracketMatching ¶
EnableBracketMatching enables bracket matching highlighting
func (*Editor) EnableMultiLine ¶
EnableMultiLine enables multi-line editing
func (*Editor) GetAliases ¶
GetAliases returns all defined aliases
func (*Editor) GetHistory ¶
GetHistory returns a copy of the command history
func (*Editor) GetSelection ¶
GetSelection returns selected text between mark and cursor
func (*Editor) IncrementalSearch ¶
IncrementalSearch performs incremental search through history
func (*Editor) KillRegion ¶
func (e *Editor) KillRegion()
KillRegion cuts selected text to kill ring
func (*Editor) LowercaseWord ¶
func (e *Editor) LowercaseWord()
LowercaseWord converts word to lowercase
func (*Editor) RemoveAlias ¶
RemoveAlias removes a command alias
func (*Editor) SetCompletionFunction ¶
SetCompletionFunction sets a custom completion function
func (*Editor) SetCompletions ¶
SetCompletions sets the list of completion words
func (*Editor) SetEditMode ¶
SetEditMode sets the editing mode (emacs or vi)
func (*Editor) SetEmacsMode ¶
func (e *Editor) SetEmacsMode()
SetEmacsMode enables emacs editing mode (default)
func (*Editor) SetHintFunction ¶
SetHintFunction sets a function that provides hints while typing
func (*Editor) SetHistoryFile ¶
SetHistoryFile sets the history file path for persistent history
func (*Editor) SetIgnoreCase ¶
SetIgnoreCase sets case sensitivity for completions and search
func (*Editor) SetMaxHistory ¶
SetMaxHistory sets the maximum number of history entries
func (*Editor) SetPromptColor ¶
SetPromptColor enables/disables colored prompt
func (*Editor) SetSyntaxHighlighter ¶
func (e *Editor) SetSyntaxHighlighter(fn SyntaxHighlighter)
SetSyntaxHighlighter sets a custom syntax highlighter function
func (*Editor) SetValidator ¶
SetValidator sets a function that validates input before accepting
func (*Editor) SetWordBreakChars ¶
SetWordBreakChars sets the characters that break words
func (*Editor) StartMacro ¶
StartMacro starts recording a keyboard macro
func (*Editor) TransposeChars ¶
func (e *Editor) TransposeChars()
TransposeChars swaps character before cursor with character at cursor
func (*Editor) TransposeWords ¶
func (e *Editor) TransposeWords()
TransposeWords swaps word before cursor with word after cursor
func (*Editor) UppercaseWord ¶
func (e *Editor) UppercaseWord()
UppercaseWord converts word to uppercase
func (*Editor) ViModeIndicator ¶
ViModeIndicator returns a string indicating current vi mode
func (*Editor) YankFromKillRing ¶
func (e *Editor) YankFromKillRing()
YankFromKillRing pastes from kill ring
type Filter ¶
type Filter interface {
ProcessInput(input string) string
ProcessOutput(output string) string
ProcessPrompt(prompt string) string
}
Filter represents an input/output filter similar to rlwrap filters
type PasswordFilter ¶
type PasswordFilter struct {
// contains filtered or unexported fields
}
Simple password filter that hides password prompts
func NewPasswordFilter ¶
func NewPasswordFilter(patterns []string) *PasswordFilter
NewPasswordFilter creates a new password filter
func (*PasswordFilter) ProcessInput ¶
func (pf *PasswordFilter) ProcessInput(input string) string
func (*PasswordFilter) ProcessOutput ¶
func (pf *PasswordFilter) ProcessOutput(output string) string
func (*PasswordFilter) ProcessPrompt ¶
func (pf *PasswordFilter) ProcessPrompt(prompt string) string
type SyntaxHighlighter ¶
SyntaxHighlighter is a function that colorizes input