forked from RasmusLindroth/tut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
48 lines (44 loc) · 1.79 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/RasmusLindroth/tut/auth"
"github.com/RasmusLindroth/tut/config"
"github.com/RasmusLindroth/tut/ui"
"github.com/RasmusLindroth/tut/util"
"github.com/rivo/tview"
)
const version = "1.0.28"
func main() {
util.SetTerminalTitle("tut")
util.MakeDirs()
newUser, selectedUser, cnfPath, cnfDir := ui.CliView(version)
accs := auth.StartAuth(newUser)
app := tview.NewApplication()
t := &ui.Tut{
App: app,
Config: config.Load(cnfPath, cnfDir),
}
if t.Config.General.MouseSupport {
app.EnableMouse(true)
}
tview.Styles = tview.Theme{
PrimitiveBackgroundColor: t.Config.Style.Background, // background
ContrastBackgroundColor: t.Config.Style.Text, //background for button, checkbox, form, modal
MoreContrastBackgroundColor: t.Config.Style.Text, //background for dropdown
BorderColor: t.Config.Style.Background, //border
TitleColor: t.Config.Style.Text, //titles
GraphicsColor: t.Config.Style.Text, //borders
PrimaryTextColor: t.Config.Style.StatusBarViewBackground, //backround color selected
SecondaryTextColor: t.Config.Style.Text, //text
TertiaryTextColor: t.Config.Style.Text, //list secondary
InverseTextColor: t.Config.Style.Text, //label activated
ContrastSecondaryTextColor: t.Config.Style.Text, //foreground on input and prefix on dropdown
}
main := ui.NewTutView(t, accs, selectedUser)
app.SetInputCapture(main.Input)
if t.Config.General.MouseSupport {
app.SetMouseCapture(main.MouseInput)
}
if err := app.SetRoot(main.View, true).Run(); err != nil {
panic(err)
}
}