-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
44 lines (39 loc) · 788 Bytes
/
main.go
File metadata and controls
44 lines (39 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"flag"
"fmt"
"os"
"task-tracker/cmd"
)
var showUsage = func() {
fmt.Println("Usage: task-tracker [command] [options]")
fmt.Println(`Commands:
add: Add a new task to the tracker
update: Update an existing task in the tracker
delete: Delete a task from the tracker
list: List all tasks in the tracker
mark-in-progress: Mark a task as in progress
mark-done: Mark a task as done`)
}
func main() {
flag.Usage = showUsage
if len(os.Args) < 2 {
flag.Usage()
return
}
command := os.Args[1]
switch command {
case "add":
cmd.AddTask()
case "update":
cmd.UpdateTask()
case "delete":
cmd.DeleteTask()
case "list":
cmd.ListTasks()
case "mark-in-progress", "mark-done":
cmd.MarkTask()
default:
flag.Usage()
}
}