feat: adding progress command

This commit is contained in:
2026-04-03 11:41:42 +02:00
parent be1dd05d9b
commit 5325c18c4e
2 changed files with 33 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strconv"
"gotask-cli/commands"
"gotask-cli/utils"
@@ -17,7 +18,7 @@ func main() {
case "help":
commands.Help()
case "add":
if len(os.Args[1:]) >= 2 {
if len(os.Args[1:]) == 2 {
backlog = commands.AddTask(os.Args[2], backlog)
} else {
fmt.Println("Missing argument")
@@ -25,6 +26,19 @@ func main() {
}
case "list":
commands.ListTasks(backlog)
case "progress":
if len(os.Args[1:]) == 2 {
id, err := strconv.ParseUint(os.Args[2], 10, 32)
utils.Check(err)
if id > 0 && id <= uint64(len(backlog)) {
commands.ProgressTask(uint(id)-1, backlog)
} else {
fmt.Printf("No task found with id=%d, try list to get id", id)
}
} else {
fmt.Println("Missing argument")
commands.Help()
}
default:
fmt.Println("NO !")
}