Documentation
¶
Index ¶
- func BlueprintLocalFilePicker(styles *stylespkg.Styles) (filepicker.Model, error)
- func SafeWidth(width int) int
- func ToFullBlueprintPath(blueprintFile, source string) string
- func ToFullFilePath(file, location string) string
- func TruncatePath(path string, maxLen int) string
- func WrapLabelled(prefix string, value string, width int) string
- type BluelinkListItem
- type ClearSelectedBlueprintMsg
- type ClearSelectedFileMsg
- type InputLocalFileModel
- type ItemDelegate
- type SelectBlueprintFileErrorMsg
- type SelectBlueprintModel
- type SelectBlueprintMsg
- type SelectBlueprintSourceMsg
- type SelectBlueprintStartMsg
- type SelectFileConfig
- type SelectFileErrorMsg
- type SelectFileLocationMsg
- type SelectFileMode
- type SelectFileModel
- type SelectFileMsg
- type SelectFileStartMsg
- type SelectLocalFileModel
- type SelectModel
- type SelectRemoteFileConfig
- type SelectRemoteFileModel
- type SelectWithPreviewModel
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
SafeWidth returns a safe width for separator lines, ensuring it's never negative.
func ToFullBlueprintPath ¶
ToFullBlueprintPath returns the full path to the blueprint file based on the source.
func ToFullFilePath ¶ added in v0.1.4
ToFullFilePath returns the full path including the scheme for remote locations.
func TruncatePath ¶ added in v0.2.0
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
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 ¶
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) 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) Spacing ¶
func (d ItemDelegate) Spacing() int
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) View ¶
func (m SelectBlueprintModel) View() string
type SelectBlueprintMsg ¶
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) View ¶ added in v0.1.4
func (m SelectFileModel) View() string
type SelectFileMsg ¶ added in v0.1.4
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) View ¶ added in v0.1.4
func (m SelectLocalFileModel) View() string
type SelectModel ¶
type SelectModel struct {
// contains filtered or unexported fields
}
func (SelectModel) Init ¶
func (m SelectModel) Init() 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) View ¶ added in v0.1.4
func (m SelectRemoteFileModel) View() string
type SelectWithPreviewModel ¶
type SelectWithPreviewModel struct {
// contains filtered or unexported fields
}
func NewSelectWithPreview ¶
func (SelectWithPreviewModel) Init ¶
func (m SelectWithPreviewModel) Init() tea.Cmd
func (SelectWithPreviewModel) View ¶
func (m SelectWithPreviewModel) View() string