Files
ProxyPilot/internal/tui/run.go
T
Finessse d6dd24e2b7 feat(tui): add polished Flight Deck terminal dashboard
- Bubbletea-based TUI with 5 tabs: Status, Accounts, Rate Limits, Usage, Logs
- Industrial control room aesthetic with orange/green color scheme
- Double-line borders (╔═╗), active tab indicator 【】
- 3-column stat boxes on Status, 4-column on Usage
- Visual gauge bar for rate limit availability
- Config-optional mode allows TUI to run without config.yaml
- Full-width frame with properly aligned borders
2026-01-12 07:33:04 +07:00

46 lines
905 B
Go

package tui
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
)
// Run starts the TUI application.
func Run(proxyURL, managementKey string) error {
if proxyURL == "" {
proxyURL = "http://127.0.0.1:8318"
}
model := NewModel(proxyURL, managementKey)
p := tea.NewProgram(model, tea.WithAltScreen())
if _, err := p.Run(); err != nil {
return fmt.Errorf("failed to run TUI: %w", err)
}
return nil
}
// RunWithStdio runs the TUI with custom stdio (for embedding in other programs).
func RunWithStdio(proxyURL, managementKey string, in *os.File, out *os.File) error {
if proxyURL == "" {
proxyURL = "http://127.0.0.1:8318"
}
model := NewModel(proxyURL, managementKey)
p := tea.NewProgram(
model,
tea.WithAltScreen(),
tea.WithInput(in),
tea.WithOutput(out),
)
if _, err := p.Run(); err != nil {
return fmt.Errorf("failed to run TUI: %w", err)
}
return nil
}