feat: suggest the most similar task name when a given task does not exist

This commit is contained in:
Max Pushkarov
2022-10-02 18:49:38 +03:00
parent d2061ec898
commit 3e5ee2332a
7 changed files with 48 additions and 6 deletions

View File

@@ -24,7 +24,11 @@ func (e *Executor) FastCompiledTask(call taskfile.Call) (*taskfile.Task, error)
func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskfile.Task, error) {
origTask, ok := e.Taskfile.Tasks[call.Task]
if !ok {
return nil, &taskNotFoundError{call.Task}
didYouMean := ""
if e.fuzzyModel != nil {
didYouMean = e.fuzzyModel.SpellCheck(call.Task)
}
return nil, &taskNotFoundError{taskName: call.Task, didYouMean: didYouMean}
}
var vars *taskfile.Vars