-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
40 lines (32 loc) · 896 Bytes
/
main.go
File metadata and controls
40 lines (32 loc) · 896 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
34
35
36
37
38
39
40
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/davidcanhelp/dbtui/internal/dropbox"
"github.com/davidcanhelp/dbtui/internal/model"
)
const version = "1.0.0"
func main() {
// Handle version flag
if len(os.Args) > 1 && (os.Args[1] == "--version" || os.Args[1] == "-v") {
fmt.Printf("dbtui version %s\n", version)
os.Exit(0)
}
// Detect Dropbox path
dropboxPath, err := dropbox.DetectDropboxPath()
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
fmt.Fprintln(os.Stderr, "\nPlease ensure Dropbox is installed and set up on your system.")
os.Exit(1)
}
// Create the model
m := model.NewModel(dropboxPath)
// Create the Bubble Tea program
p := tea.NewProgram(m, tea.WithAltScreen())
// Run the program
if _, err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "Error running program: %v\n", err)
os.Exit(1)
}
}