mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
refactor: lazy load fuzzy model & ability to disable it
This commit is contained in:
10
task.go
10
task.go
@@ -452,8 +452,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,
|
||||
|
||||
Reference in New Issue
Block a user