// A simple TUI application that charts latency times to specified hosts. // // TODO(main): set chart height by user flag // // TODO(main): determine chart heights dynamically by number of addresses // // TODO(performance): implement ping message channel buffering // // TODO(tui): notify user when an address is not resolving // // i.e, change the address title to red so long as there is a single -1 in // the display buffer, and a toast notification (???) if a display buffer is // entirely composed of -1 package main import ( "flag" "fmt" "os" "pingo/internal/tui" "time" tea "github.com/charmbracelet/bubbletea" ) func main() { speed := flag.Int("s", 80, "the speed with which the UI runs") flag.Parse() hosts := flag.Args() if len(hosts) == 0 { fmt.Println("Must specify hosts!") return } var model = tui.InitialModel( hosts, time.Duration(*speed), ) p := tea.NewProgram(model, tea.WithAltScreen(), // use the full size of the terminal in its "alternate screen buffer" // tea.WithMouseCellMotion(), // turn on mouse support so we can track the mouse wheel ) if _, err := p.Run(); err != nil { fmt.Printf("Alas, there's been an error: %v", err) os.Exit(1) } }