mirror of
https://github.com/go-task/task.git
synced 2025-02-09 13:47:06 +02:00
Refactor: Use early return
This commit is contained in:
parent
fd71dfda6a
commit
a990ffe53d
30
setup.go
30
setup.go
@ -91,21 +91,23 @@ func (e *Executor) readTaskfile() error {
|
|||||||
|
|
||||||
func (e *Executor) setupFuzzyModel() {
|
func (e *Executor) setupFuzzyModel() {
|
||||||
if e.Taskfile != nil {
|
if e.Taskfile != nil {
|
||||||
model := fuzzy.NewModel()
|
return
|
||||||
model.SetThreshold(1) // because we want to build grammar based on every task name
|
|
||||||
|
|
||||||
var words []string
|
|
||||||
for taskName := range e.Taskfile.Tasks {
|
|
||||||
words = append(words, taskName)
|
|
||||||
|
|
||||||
for _, task := range e.Taskfile.Tasks {
|
|
||||||
words = append(words, task.Aliases...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model.Train(words)
|
|
||||||
e.fuzzyModel = model
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model := fuzzy.NewModel()
|
||||||
|
model.SetThreshold(1) // because we want to build grammar based on every task name
|
||||||
|
|
||||||
|
var words []string
|
||||||
|
for taskName := range e.Taskfile.Tasks {
|
||||||
|
words = append(words, taskName)
|
||||||
|
|
||||||
|
for _, task := range e.Taskfile.Tasks {
|
||||||
|
words = append(words, task.Aliases...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model.Train(words)
|
||||||
|
e.fuzzyModel = model
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Executor) setupTempDir() error {
|
func (e *Executor) setupTempDir() error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user