-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
79 lines (67 loc) · 1.01 KB
/
main.go
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
)
type status int
func (s status) getNext() status {
if s == done {
return todo
}
return s + 1
}
func (s status) getPrev() status {
if s == todo {
return done
}
return s - 1
}
// status to string
func (s status) String() string {
switch s {
case todo:
return "todo"
case inProgress:
return "inProgress"
case done:
return "done"
}
return "unknown"
}
// string to status
func StrToStatus(s string) status {
switch s {
case "todo":
case "Todo":
return todo
case "inProgress":
case "In Progress":
return inProgress
case "done":
case "Done":
return done
}
return todo
}
const margin = 4
var board *Board
const (
todo status = iota
inProgress
done
)
func main() {
f, err := tea.LogToFile("debug.log", "debug")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer f.Close()
project := NewProject()
p := tea.NewProgram(project)
if _, err := p.Run(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}