-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (26 loc) · 743 Bytes
/
main.go
File metadata and controls
32 lines (26 loc) · 743 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
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/dotlabshq/synapse-admin/internal/api"
"github.com/dotlabshq/synapse-admin/internal/config"
"github.com/dotlabshq/synapse-admin/internal/ui/model"
)
func main() {
cfg, err := config.Load()
if err != nil {
fmt.Fprintf(os.Stderr, "config error: %v\n", err)
os.Exit(1)
}
var client *api.Client
if cfg.Server.Homeserver != "" && cfg.Server.AccessToken != "" {
client = api.NewClient(cfg.Server.Homeserver, cfg.Server.AccessToken)
}
root := model.New(cfg, client)
p := tea.NewProgram(root, tea.WithAltScreen(), tea.WithMouseCellMotion())
if _, err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}