mirror of
https://github.com/go-task/task.git
synced 2025-12-16 11:47:44 +01:00
refactor: optimize fuzzy matching with lazy initialization (#2523)
This commit is contained in:
7
task.go
7
task.go
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user