-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (27 loc) · 634 Bytes
/
Copy pathmain.go
File metadata and controls
33 lines (27 loc) · 634 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
33
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/meru143/crontui/internal/cli"
"github.com/meru143/crontui/internal/config"
"github.com/meru143/crontui/internal/model"
)
func main() {
// If CLI subcommand provided, run non-interactively
if cli.Run(os.Args) {
return
}
// Launch interactive TUI
cfg, err := config.Load()
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading config: %v\n", err)
os.Exit(1)
}
m := model.New(cfg)
p := tea.NewProgram(m, tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}