Documentation
¶
Overview ¶
Package tui contains the interactive terminal UIs built with charmbracelet/bubbletea. Each wizard also has a non-interactive flag-driven path; the TUI is only launched when both stdin and stdout are terminals and required flags are missing.
Index ¶
- Variables
- func IsInteractive() bool
- func RunCreateWizard(opts CreateWizardOptions) error
- func RunRenameWizard(opts RenameWizardOptions) error
- func RunServiceWizard(opts ServiceWizardOptions) error
- type CreateWizard
- type CreateWizardOptions
- type RenameWizard
- type RenameWizardOptions
- type ServiceKind
- type ServiceWizard
- type ServiceWizardOptions
Constants ¶
This section is empty.
Variables ¶
var ( // TitleStyle renders wizard titles. TitleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color(accentColor)).MarginBottom(1) // SubtitleStyle renders secondary titles and step hints. SubtitleStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")) // ErrorStyle renders error messages. ErrorStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("196")) // WarningStyle renders fallback notices. WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("214")) // SuccessStyle renders final success banners. SuccessStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("42")) // DetailStyle renders log/detail lines under the progress bar. DetailStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")) // FieldLabelStyle renders form field labels. FieldLabelStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("39")) // ValueStyle renders confirmed values in summaries. ValueStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("252")) // PanelStyle draws the summary/confirm panel border. PanelStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("31")). Padding(1, 2) )
Functions ¶
func IsInteractive ¶
func IsInteractive() bool
IsInteractive reports whether the CLI is attached to a terminal on both ends. Wizards require a TTY; scripted runs fall back to flags.
func RunCreateWizard ¶
func RunCreateWizard(opts CreateWizardOptions) error
RunCreateWizard launches the interactive project creation flow. It returns an error only when the UI itself fails; pipeline failures surface on the wizard's error screen and are re-reported by the final summary.
func RunRenameWizard ¶
func RunRenameWizard(opts RenameWizardOptions) error
RunRenameWizard launches the interactive module rename flow.
func RunServiceWizard ¶
func RunServiceWizard(opts ServiceWizardOptions) error
RunServiceWizard launches the interactive service generation flow. When the user picked stdout output the generated content is printed after the UI exits, so `sphere-cli service proto | lpr` still works with a TTY stdin.
Types ¶
type CreateWizard ¶
type CreateWizard struct {
// contains filtered or unexported fields
}
func (*CreateWizard) Init ¶
func (m *CreateWizard) Init() tea.Cmd
func (*CreateWizard) View ¶
func (m *CreateWizard) View() string
type CreateWizardOptions ¶
CreateWizardOptions prefills the wizard from CLI flags.
type RenameWizard ¶
type RenameWizard struct {
// contains filtered or unexported fields
}
func (*RenameWizard) Init ¶
func (m *RenameWizard) Init() tea.Cmd
func (*RenameWizard) View ¶
func (m *RenameWizard) View() string
type RenameWizardOptions ¶
RenameWizardOptions prefills the wizard from CLI flags.
type ServiceKind ¶
type ServiceKind int
ServiceKind selects which generator the wizard drives.
const ( // ServiceKindProto generates the entity CRUD .proto file. ServiceKindProto ServiceKind = iota // ServiceKindGolang generates the entity service skeleton .go file. ServiceKindGolang )
type ServiceWizard ¶
type ServiceWizard struct {
// contains filtered or unexported fields
}
func (*ServiceWizard) Init ¶
func (m *ServiceWizard) Init() tea.Cmd
func (*ServiceWizard) View ¶
func (m *ServiceWizard) View() string
type ServiceWizardOptions ¶
type ServiceWizardOptions struct {
Kind ServiceKind
// CWD is the working directory used for schema detection, module
// detection, and relative output paths.
CWD string
Name string
Pkg string
Mod string
Out string
}
ServiceWizardOptions prefills the wizard from CLI flags and CWD detection.