Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KnownCommands = []string{
"SyncRemoteToLocal",
"SyncLocalToRemote",
}
KnownCommands is the list of all recognized command names.
Functions ¶
func FuzzyMatchString ¶
FuzzyMatchString checks if query fuzzy-matches target (case-insensitive subsequence). Returns score, matched byte indices, and whether all query chars were found.
Types ¶
type Command ¶
type Command struct {
Kind CommandKind
Args []string // positional arguments after the command name
Raw string // original input
}
Command is the result of parsing a raw command-line string.
type CommandKind ¶
type CommandKind int
CommandKind identifies the parsed command type.
const ( CmdUnknown CommandKind = iota CmdSyncRemoteToLocal // SyncRemoteToLocal <remote_dir> <local_dir> CmdSyncLocalToRemote // SyncLocalToRemote <local_dir> <remote_dir> )
type FuzzyResult ¶
type FuzzyResult struct {
Command string
Score int
MatchIndices []int // byte indices in Command where query chars matched
}
FuzzyResult holds a fuzzy match with scoring and match positions.
func FuzzyMatch ¶
func FuzzyMatch(query string) []FuzzyResult
FuzzyMatch returns known commands whose names fuzzy-match the query (characters appear in order as a subsequence, case-insensitive). Results are sorted by score descending. Returns nil if query is empty.
type InputContext ¶
type InputContext struct {
Command string // first token (if complete), else ""
CommandKind CommandKind // parsed kind of the command
ArgIndex int // 0-based arg being edited; -1 = still typing command
Partial string // incomplete text being typed for current position
}
InputContext describes the editing position within a command-line input.
func AnalyzeInput ¶
func AnalyzeInput(raw string) InputContext
AnalyzeInput examines raw command-line text and returns the editing context. The cursor is assumed to be at the end of raw.