-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
37 lines (30 loc) · 819 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
package main
import (
"context"
"fmt"
"net/http"
"os"
"time"
"github.com/KarolosLykos/hackertea/internal/cache"
"github.com/KarolosLykos/hackertea/internal/client"
"github.com/KarolosLykos/hackertea/internal/constants"
"github.com/KarolosLykos/hackertea/internal/hn"
"github.com/KarolosLykos/hackertea/internal/tui/model"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
ctx := context.Background()
c := client.New(constants.BaseURL, &http.Client{Timeout: 10 * time.Second})
memCache := cache.New()
hnClient := hn.New(c, memCache)
m, err := model.New(ctx, hnClient)
if err != nil {
fmt.Println("Error creating model: ", err)
os.Exit(1)
}
p := tea.NewProgram(m, tea.WithAltScreen())
if _, err = p.Run(); err != nil {
fmt.Println("Error running program: ", err)
os.Exit(1)
}
}