feat: adding regress command
This commit is contained in:
18
commands/regress_task.go
Normal file
18
commands/regress_task.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gotask-cli/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RegressTask(id uint, backlog []models.Task) []models.Task {
|
||||
if backlog[id].Status >= 1 && backlog[id].Status <= 2 {
|
||||
backlog[id].Status--
|
||||
backlog[id].Updated = time.Now().Unix()
|
||||
fmt.Printf("[%s] task \"%s\" regress to [%s]", models.StatusName[backlog[id].Status+1], backlog[id].Description, models.StatusName[backlog[id].Status])
|
||||
} else {
|
||||
fmt.Printf("Can't regress task %s", backlog[id].Description)
|
||||
}
|
||||
return backlog
|
||||
}
|
||||
Reference in New Issue
Block a user