refactor: optimize fuzzy matching with lazy initialization (#2523)

This commit is contained in:
Valentin Maerten
2025-12-07 21:43:26 +01:00
committed by GitHub
parent b1814277c2
commit a40ddd4949
12 changed files with 64 additions and 10 deletions

View File

@@ -456,8 +456,11 @@ func (e *Executor) GetTask(call *Call) (*ast.Task, error) {
// If we found no tasks
if len(aliasedTasks) == 0 {
didYouMean := ""
if e.fuzzyModel != nil {
didYouMean = e.fuzzyModel.SpellCheck(call.Task)
if !e.DisableFuzzy {
e.fuzzyModelOnce.Do(e.setupFuzzyModel)
if e.fuzzyModel != nil {
didYouMean = e.fuzzyModel.SpellCheck(call.Task)
}
}
return nil, &errors.TaskNotFoundError{
TaskName: call.Task,