-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (38 loc) · 1.05 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
package main
import (
"github.com/windler/mayboy/events"
"github.com/windler/mayboy/gitlab"
"github.com/rivo/tview"
"github.com/windler/mayboy/config"
"github.com/windler/mayboy/elements"
)
func main() {
cfg := config.Parse()
issues := gitlab.GetIssues(cfg)
em := events.NewEventManager()
app := tview.NewApplication()
header := elements.NewHeader()
projectList := elements.CreateProjectList(issues, em)
issueTable := elements.CreateIssueTable(em, &projectList)
tableInfo := elements.NewTableInfo(em, &issueTable)
footer := elements.NewFooter(em)
grid := elements.CreateGrid(
header.GetPrimitive(),
projectList.GetPrimitive(),
issueTable.GetPrimitive(),
tableInfo.GetPrimitive(),
footer.GetPrimitive(),
)
em.Listen(events.ProjectSelected, func() {
app.SetFocus(issueTable.GetPrimitive())
})
em.Listen(events.IssueTableFocusLost, func() {
app.SetFocus(projectList.GetPrimitive())
})
em.Listen(events.ExitRequested, func() {
app.Stop()
})
if err := app.SetRoot(grid.GetPrimitive(), true).Run(); err != nil {
panic(err)
}
}