ui

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 20 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlueprintLocalFilePicker

func BlueprintLocalFilePicker(styles *stylespkg.Styles) (filepicker.Model, error)

BlueprintLocalFilePicker creates a new filepicker model for selecting a local blueprint file relative to the current working directory.

func SafeWidth added in v0.1.2

func SafeWidth(width int) int

SafeWidth returns a safe width for separator lines, ensuring it's never negative.

func ToFullBlueprintPath

func ToFullBlueprintPath(blueprintFile, source string) string

ToFullBlueprintPath returns the full path to the blueprint file based on the source.

func ToFullFilePath added in v0.1.4

func ToFullFilePath(file, location string) string

ToFullFilePath returns the full path including the scheme for remote locations.

func TruncatePath added in v0.2.0

func TruncatePath(path string, maxLen int) string

TruncatePath shortens a file path to fit within maxLen characters, preserving the file name and as much of the trailing directory context as possible. For example, "/very/long/path/to/project.blueprint.yml" with maxLen 30 becomes "…/to/project.blueprint.yml".

func WrapLabelled added in v0.10.0

func WrapLabelled(prefix string, value string, width int) string

WrapLabelled renders prefix followed by value, wrapping the value to fit within width and aligning continuation lines under the start of the value. The prefix holds any indentation and the label, e.g. " Target: ". Values without spaces, such as long paths, are broken mid-word. In a terminal too narrow to leave the value a readable column, the whole line is wrapped to width instead, without the alignment.

Types

type BluelinkListItem

type BluelinkListItem struct {
	Key   string
	Label string
	Desc  string
}

BluelinkListItem represents an item in a Bluelink list component.

func (BluelinkListItem) Description

func (i BluelinkListItem) Description() string

func (BluelinkListItem) FilterValue

func (i BluelinkListItem) FilterValue() string

func (BluelinkListItem) Title

func (i BluelinkListItem) Title() string

type ClearSelectedBlueprintMsg

type ClearSelectedBlueprintMsg struct{}

ClearSelectedBlueprintMsg is sent to clear the current blueprint selection.

type ClearSelectedFileMsg added in v0.1.4

type ClearSelectedFileMsg struct{}

ClearSelectedFileMsg is sent to clear the current selection.

type InputLocalFileModel added in v0.10.0

type InputLocalFileModel struct {
	// contains filtered or unexported fields
}

InputLocalFileModel provides a path input for a local file that is about to be written, which may not exist yet.

func NewInputLocalFile added in v0.10.0

func NewInputLocalFile(
	styles *stylespkg.Styles,
	fileTypeName string,
	defaultFile string,
	workingDir string,
) *InputLocalFileModel

NewInputLocalFile creates a path input for a local file to be written. Relative paths are resolved against workingDir, and defaultFile pre-fills the input.

func (InputLocalFileModel) Init added in v0.10.0

func (m InputLocalFileModel) Init() tea.Cmd

func (InputLocalFileModel) Update added in v0.10.0

func (m InputLocalFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (InputLocalFileModel) View added in v0.10.0

func (m InputLocalFileModel) View() string

type ItemDelegate

type ItemDelegate struct {
	// contains filtered or unexported fields
}

ItemDelegate renders list items using Bluelink styles.

func (ItemDelegate) Height

func (d ItemDelegate) Height() int

func (ItemDelegate) Render

func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item)

func (ItemDelegate) Spacing

func (d ItemDelegate) Spacing() int

func (ItemDelegate) Update

func (d ItemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd

type SelectBlueprintFileErrorMsg

type SelectBlueprintFileErrorMsg struct {
	Err error
}

SelectBlueprintFileErrorMsg is sent when there's an error during blueprint selection.

type SelectBlueprintModel

type SelectBlueprintModel struct {
	// contains filtered or unexported fields
}

SelectBlueprintModel wraps SelectFileModel with blueprint-specific configuration.

func NewSelectBlueprint

func NewSelectBlueprint(
	blueprintFile string,
	autoSelect bool,
	action string,
	styles *stylespkg.Styles,
	fp *filepicker.Model,
) (*SelectBlueprintModel, error)

NewSelectBlueprint creates a new blueprint selection model.

func (SelectBlueprintModel) Init

func (m SelectBlueprintModel) Init() tea.Cmd

func (SelectBlueprintModel) SelectedFile added in v0.1.4

func (m SelectBlueprintModel) SelectedFile() string

SelectedFile returns the currently selected blueprint file path.

func (SelectBlueprintModel) SelectedSource added in v0.1.4

func (m SelectBlueprintModel) SelectedSource() string

SelectedSource returns the source type of the selected blueprint file.

func (SelectBlueprintModel) Update

func (m SelectBlueprintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectBlueprintModel) View

func (m SelectBlueprintModel) View() string

type SelectBlueprintMsg

type SelectBlueprintMsg struct {
	BlueprintFile string
	Source        string
}

SelectBlueprintMsg is sent when a blueprint file has been selected.

type SelectBlueprintSourceMsg

type SelectBlueprintSourceMsg struct {
	Source string
}

SelectBlueprintSourceMsg is sent when a blueprint source has been selected.

type SelectBlueprintStartMsg

type SelectBlueprintStartMsg struct {
	Selection string
}

SelectBlueprintStartMsg is sent when the user makes a selection at the start screen.

type SelectFileConfig added in v0.1.4

type SelectFileConfig struct {
	// InitialFile is the default file path or URL to pre-select.
	InitialFile string
	// AutoSelect automatically selects the initial file without user interaction.
	AutoSelect bool
	// Action is used in prompts (e.g., "import", "validate", "deploy").
	Action string
	// Styles provides theming for the UI components.
	Styles *stylespkg.Styles
	// FilePicker is the configured file picker for local file selection.
	FilePicker *filepicker.Model
	// FileTypeName is an optional descriptor for the file type (e.g., "blueprint", "state archive").
	// When set, it's interpolated into prompts like "Pick a blueprint file:".
	// If empty, generic "file" terminology is used.
	FileTypeName string
	// RemoteFileConfig provides configuration for remote file input.
	RemoteFileConfig *SelectRemoteFileConfig
	// SupportedLocations specifies which file locations are available for selection.
	// If nil or empty, all locations are supported (Local, S3, GCS, Azure Blob, HTTPS).
	SupportedLocations []string
	// Mode is SelectFileModeOpen (the default) to choose an existing file, or
	// SelectFileModeSave to choose where a new file will be written.
	Mode SelectFileMode
	// DefaultFileName pre-fills the local file path in SelectFileModeSave.
	DefaultFileName string
}

SelectFileConfig holds configuration for the file selector.

type SelectFileErrorMsg added in v0.1.4

type SelectFileErrorMsg struct {
	Err error
}

SelectFileErrorMsg is sent when there's an error during file selection.

type SelectFileLocationMsg added in v0.10.0

type SelectFileLocationMsg struct {
	Location string
}

SelectFileLocationMsg is sent when a location has been selected.

type SelectFileMode added in v0.10.0

type SelectFileMode int

SelectFileMode determines whether the selected file is read or written.

const (
	// SelectFileModeOpen chooses an existing file to read, with a file picker for local files.
	SelectFileModeOpen SelectFileMode = iota
	// SelectFileModeSave chooses where a file will be written, with a path input for local
	// files so the file does not need to exist yet.
	SelectFileModeSave
)

type SelectFileModel added in v0.1.4

type SelectFileModel struct {
	// contains filtered or unexported fields
}

SelectFileModel provides a generalized file selection interface that supports both local files and remote storage (S3, GCS, Azure Blob, HTTPS).

func NewSelectFile added in v0.1.4

func NewSelectFile(config SelectFileConfig) (*SelectFileModel, error)

NewSelectFile creates a new file selection model.

func (SelectFileModel) Init added in v0.1.4

func (m SelectFileModel) Init() tea.Cmd

func (SelectFileModel) SelectedFile added in v0.1.4

func (m SelectFileModel) SelectedFile() string

SelectedFile returns the currently selected file path.

func (SelectFileModel) SelectedLocation added in v0.10.0

func (m SelectFileModel) SelectedLocation() string

SelectedLocation returns the location type of the selected file.

func (SelectFileModel) Update added in v0.1.4

func (m SelectFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectFileModel) View added in v0.1.4

func (m SelectFileModel) View() string

type SelectFileMsg added in v0.1.4

type SelectFileMsg struct {
	File     string
	Location string
}

SelectFileMsg is sent when a file has been selected.

type SelectFileStartMsg added in v0.1.4

type SelectFileStartMsg struct {
	Selection string
}

SelectFileStartMsg is sent when the user makes a selection at the start screen.

type SelectLocalFileModel added in v0.1.4

type SelectLocalFileModel struct {
	// contains filtered or unexported fields
}

SelectLocalFileModel provides a file picker for selecting local files.

func NewSelectLocalFile added in v0.1.4

func NewSelectLocalFile(
	fp *filepicker.Model,
	styles *stylespkg.Styles,
	prompt string,
	fileTypeName string,
) (*SelectLocalFileModel, error)

NewSelectLocalFile creates a new local file selection model.

func (SelectLocalFileModel) Init added in v0.1.4

func (m SelectLocalFileModel) Init() tea.Cmd

func (SelectLocalFileModel) Update added in v0.1.4

func (m SelectLocalFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectLocalFileModel) View added in v0.1.4

func (m SelectLocalFileModel) View() string

type SelectModel

type SelectModel struct {
	// contains filtered or unexported fields
}

func NewSelect

func NewSelect(
	title string,
	listItems []list.Item,
	styles *stylespkg.Styles,
	selectCommand func(string) tea.Cmd,
	enableFiltering bool,
) *SelectModel

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

func (SelectModel) Update

func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectModel) View

func (m SelectModel) View() string

type SelectRemoteFileConfig added in v0.1.4

type SelectRemoteFileConfig struct {
	// URLTitle is the title for the HTTPS URL input field.
	// Defaults to "HTTPS resource URL".
	URLTitle string
	// URLDescription is the description for the HTTPS URL input field.
	// Defaults to "The public URL of the file to download."
	URLDescription string
	// URLPlaceholder is the placeholder for the HTTPS URL input field.
	// Defaults to "https://assets.example.com/project.blueprint".
	URLPlaceholder string
	// BucketNameTitle overrides the bucket name title for a specific location.
	// Map keys are location constants (e.g., consts.FileLocationS3).
	BucketNameTitle map[string]string
	// BucketNameDescription overrides the bucket name description for a specific location.
	BucketNameDescription map[string]string
	// BucketNamePlaceholder overrides the bucket name placeholder for a specific location.
	BucketNamePlaceholder map[string]string
	// ObjectPathDescription overrides the object path description for a specific location.
	ObjectPathDescription map[string]string
}

SelectRemoteFileConfig holds configuration for remote file selection.

type SelectRemoteFileModel added in v0.1.4

type SelectRemoteFileModel struct {
	// contains filtered or unexported fields
}

SelectRemoteFileModel provides forms for selecting files from remote locations.

func NewSelectRemoteFile added in v0.1.4

func NewSelectRemoteFile(
	initialFile string,
	styles *stylespkg.Styles,
	config *SelectRemoteFileConfig,
) *SelectRemoteFileModel

NewSelectRemoteFile creates a new remote file selection model.

func (SelectRemoteFileModel) Init added in v0.1.4

func (m SelectRemoteFileModel) Init() tea.Cmd

func (SelectRemoteFileModel) Update added in v0.1.4

func (m SelectRemoteFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectRemoteFileModel) View added in v0.1.4

func (m SelectRemoteFileModel) View() string

type SelectWithPreviewModel

type SelectWithPreviewModel struct {
	// contains filtered or unexported fields
}

func NewSelectWithPreview

func NewSelectWithPreview(
	title string,
	listItems []list.Item,
	styles *stylespkg.Styles,
	selectCommand func(string) tea.Cmd,
	enableFiltering bool,
) *SelectWithPreviewModel

func (SelectWithPreviewModel) Init

func (m SelectWithPreviewModel) Init() tea.Cmd

func (SelectWithPreviewModel) Update

func (m SelectWithPreviewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectWithPreviewModel) View

func (m SelectWithPreviewModel) View() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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