1
0
mirror of https://github.com/go-task/task.git synced 2025-11-29 22:48:03 +02:00

refactor: lazy load fuzzy model & ability to disable it

This commit is contained in:
Valentin Maerten
2025-11-23 21:12:25 +01:00
parent dcc23cf1c7
commit 3ce9cc689a
8 changed files with 75 additions and 23 deletions

10
task.go
View File

@@ -450,8 +450,14 @@ 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 {
// Lazy initialization of fuzzy model
if e.fuzzyModel == nil {
e.setupFuzzyModel()
}
if e.fuzzyModel != nil {
didYouMean = e.fuzzyModel.SpellCheck(call.Task)
}
}
return nil, &errors.TaskNotFoundError{
TaskName: call.Task,