31 lines
629 B
Go
31 lines
629 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
|
|
"github.com/lwoodard/printcontrol/internal/tui"
|
|
)
|
|
|
|
func main() {
|
|
port := flag.String("port", "", "Serial port (auto-detected if empty)")
|
|
baud := flag.Int("baud", 0, "Baud rate (0 = auto-detect)")
|
|
noConnect := flag.Bool("no-connect", false, "Don't auto-connect on launch")
|
|
flag.Parse()
|
|
|
|
m := tui.New(tui.Config{
|
|
Port: *port,
|
|
Baud: *baud,
|
|
AutoConnect: !*noConnect,
|
|
})
|
|
|
|
p := tea.NewProgram(m, tea.WithAltScreen())
|
|
if _, err := p.Run(); err != nil {
|
|
fmt.Fprintln(os.Stderr, "printcontrol:", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|