// Package ui is vault-tui's Bubbletea v2 terminal UI. It talks to Vault // exclusively through internal/vault.Service and internal/auth.Method — // never hashicorp/vault/api directly — which is what keeps this package // swappable/testable independently of the headless CLI in internal/cli // (which builds the very same Service/Method values from the same // resolved config.Settings). package ui import ( "context" "fmt" tea "charm.land/bubbletea/v2" "git.morlana.online/f.weber/vault-tui/internal/cli" ) // Run launches the TUI. Wired into internal/cli's "ui" command (and its // DefaultCommand) via cli.SetUIRunner in cmd/vault-tui/main.go, so that // internal/cli itself never has to import a TUI toolkit. func Run(ctx context.Context, a *cli.App) error { m, err := newModel(ctx, a) if err != nil { return err } p := tea.NewProgram(m, tea.WithContext(ctx)) _, err = p.Run() return err } func init() { cli.SetUIRunner(func(ctx context.Context, a *cli.App) error { if err := Run(ctx, a); err != nil { return fmt.Errorf("ui: %w", err) } return nil }) }