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
|
// Command sportsball is a terminal dashboard for live sports scores, schedules,
// and box scores across the World Cup, MLB, NBA, NHL, and NFL โ Plain Text
// Sports meets Golazo, in a Bubble Tea TUI.
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/humdrum-tiv/sportsball/internal/ui"
)
// version is the build version, overwritten at release time via
// -ldflags "-X main.version=...". Defaults to "dev" for local builds.
var version = "dev"
func main() {
if wantsVersion(os.Args[1:]) {
fmt.Println("sportsball", version)
return
}
p := tea.NewProgram(ui.New(), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Fprintln(os.Stderr, "sportsball:", err)
os.Exit(1)
}
}
// wantsVersion reports whether the args request a version print.
func wantsVersion(args []string) bool {
for _, a := range args {
switch a {
case "--version", "-v", "version":
return true
}
}
return false
}
|