-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
64 lines (50 loc) · 911 Bytes
/
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
package main
import (
"context"
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/redis/go-redis/v9"
)
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
}
const margin = 4
var board *Board
const (
todo status = iota
inProgress
done
)
var client *redis.Client
var ctx = context.Background()
func main() {
f, err := tea.LogToFile("debug.log", "debug")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer f.Close()
client = redis.NewClient(&redis.Options{
Addr: "localhost:6379", // Redis server address
})
// Close the Redis client connection when the application exits
defer client.Close()
board = NewBoard()
board.initLists()
p := tea.NewProgram(board)
if _, err := p.Run(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}