tui

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tui holds the charmbracelet-based interactive surfaces (the clover init wizard). CLI-edge only; never imported by pure core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(title, description string) (bool, error)

Confirm asks a yes/no question, returning the user's choice. It requires a TTY (the caller should gate on terminal.Is); the default is no.

func ProviderTheme

func ProviderTheme() huh.ThemeFunc

ProviderTheme is the green theme tuned for the provider-selection step: a lime title, a dim-lime description, and a regular-green selected-option row.

func SelectProviders

func SelectProviders(names []string) ([]string, error)

SelectProviders asks which upstream providers the project will use, with every provider selected by default. The returned slice is the chosen subset.

func Theme

func Theme() huh.ThemeFunc

Theme is huh's Charm theme recolored to green shades, with radio-button prefixes for multi-select fields. huh resolves it per render against the terminal background, so the green ramp - bright (focus accents), deep (selected text), muted (descriptions, unselected items) - is picked for the detected light or dark mode.

Types

type ConfigureInput

type ConfigureInput struct {
	// AuthSummary is the provider credential summary shown as a note; empty hides
	// it.
	AuthSummary string
	// Path is where the config will be written, shown in the confirmation.
	Path string
	// Exists tailors the confirmation wording for an overwrite.
	Exists bool
	// DefaultVersion pre-fills the required-version input.
	DefaultVersion string
	// ValidateVersion, when set, validates the required-version input live.
	ValidateVersion func(string) error
	// ExcludeOptions are the exclude globs offered for selection.
	ExcludeOptions []string
	// DefaultExcludes are the options preselected from ExcludeOptions.
	DefaultExcludes []string
}

ConfigureInput seeds the second wizard step.

type Settings

type Settings struct {
	// RequiredVersion is the version constraint to write, or "" for none.
	RequiredVersion string
	// Excludes are the exclude globs the user kept selected.
	Excludes []string
	// Write is whether the user confirmed writing the config.
	Write bool
}

Settings is what the second wizard step collected.

func Configure

func Configure(in ConfigureInput) (Settings, error)

Configure shows the provider authentication summary (when non-empty), asks for an optional (live-validated) required-version constraint, lets the user pick which paths to exclude, and confirms writing the config to in.Path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL