{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ui\n\n## Functions\n\n```go\nfunc BlueprintLocalFilePicker(styles *stylespkg.Styles) (filepicker.Model, error)\n```\nBlueprintLocalFilePicker creates a new filepicker model for selecting a local blueprint file relative to the current working directory.\n\n```go\nfunc SafeWidth(width int) int\n```\nSafeWidth returns a safe width for separator lines, ensuring it's never negative.\n\n```go\nfunc ToFullBlueprintPath(blueprintFile, source string) string\n```\nToFullBlueprintPath returns the full path to the blueprint file based on the source.\n\n```go\nfunc ToFullFilePath(file, location string) string\n```\nToFullFilePath returns the full path including the scheme for remote locations.\n\n```go\nfunc TruncatePath(path string, maxLen int) string\n```\nTruncatePath 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\".\n\n```go\nfunc WrapLabelled(prefix string, value string, width int) string\n```\nWrapLabelled 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.\n\n## Types\n\n```go\ntype BluelinkListItem struct {\n\tKey   string\n\tLabel string\n\tDesc  string\n}\n```\nBluelinkListItem represents an item in a Bluelink list component.\n\n```go\nfunc (i BluelinkListItem) Description() string\n```\n\n```go\nfunc (i BluelinkListItem) FilterValue() string\n```\n\n```go\nfunc (i BluelinkListItem) Title() string\n```\n\n```go\ntype ClearSelectedBlueprintMsg struct{}\n```\nClearSelectedBlueprintMsg is sent to clear the current blueprint selection.\n\n```go\ntype ClearSelectedFileMsg struct{}\n```\nClearSelectedFileMsg is sent to clear the current selection.\n\n```go\ntype InputLocalFileModel struct {\n\t// contains filtered or unexported fields\n}\n```\nInputLocalFileModel provides a path input for a local file that is about to be written, which may not exist yet.\n\n```go\nfunc NewInputLocalFile(\n\tstyles *stylespkg.Styles,\n\tfileTypeName string,\n\tdefaultFile string,\n\tworkingDir string,\n) *InputLocalFileModel\n```\nNewInputLocalFile creates a path input for a local file to be written. Relative paths are resolved against workingDir, and defaultFile pre-fills the input.\n\n```go\nfunc (m InputLocalFileModel) Init() tea.Cmd\n```\n\n```go\nfunc (m InputLocalFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m InputLocalFileModel) View() string\n```\n\n```go\ntype ItemDelegate struct {\n\t// contains filtered or unexported fields\n}\n```\nItemDelegate renders list items using Bluelink styles.\n\n```go\nfunc (d ItemDelegate) Height() int\n```\n\n```go\nfunc (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item)\n```\n\n```go\nfunc (d ItemDelegate) Spacing() int\n```\n\n```go\nfunc (d ItemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd\n```\n\n```go\ntype SelectBlueprintFileErrorMsg struct {\n\tErr error\n}\n```\nSelectBlueprintFileErrorMsg is sent when there's an error during blueprint selection.\n\n```go\ntype SelectBlueprintModel struct {\n\t// contains filtered or unexported fields\n}\n```\nSelectBlueprintModel wraps SelectFileModel with blueprint-specific configuration.\n\n```go\nfunc NewSelectBlueprint(\n\tblueprintFile string,\n\tautoSelect bool,\n\taction string,\n\tstyles *stylespkg.Styles,\n\tfp *filepicker.Model,\n) (*SelectBlueprintModel, error)\n```\nNewSelectBlueprint creates a new blueprint selection model.\n\n```go\nfunc (m SelectBlueprintModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectBlueprintModel) SelectedFile() string\n```\nSelectedFile returns the currently selected blueprint file path.\n\n```go\nfunc (m SelectBlueprintModel) SelectedSource() string\n```\nSelectedSource returns the source type of the selected blueprint file.\n\n```go\nfunc (m SelectBlueprintModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectBlueprintModel) View() string\n```\n\n```go\ntype SelectBlueprintMsg struct {\n\tBlueprintFile string\n\tSource        string\n}\n```\nSelectBlueprintMsg is sent when a blueprint file has been selected.\n\n```go\ntype SelectBlueprintSourceMsg struct {\n\tSource string\n}\n```\nSelectBlueprintSourceMsg is sent when a blueprint source has been selected.\n\n```go\ntype SelectBlueprintStartMsg struct {\n\tSelection string\n}\n```\nSelectBlueprintStartMsg is sent when the user makes a selection at the start screen.\n\n```go\ntype SelectFileConfig struct {\n\t// InitialFile is the default file path or URL to pre-select.\n\tInitialFile string\n\t// AutoSelect automatically selects the initial file without user interaction.\n\tAutoSelect bool\n\t// Action is used in prompts (e.g., \"import\", \"validate\", \"deploy\").\n\tAction string\n\t// Styles provides theming for the UI components.\n\tStyles *stylespkg.Styles\n\t// FilePicker is the configured file picker for local file selection.\n\tFilePicker *filepicker.Model\n\t// FileTypeName is an optional descriptor for the file type (e.g., \"blueprint\", \"state archive\").\n\t// When set, it's interpolated into prompts like \"Pick a blueprint file:\".\n\t// If empty, generic \"file\" terminology is used.\n\tFileTypeName string\n\t// RemoteFileConfig provides configuration for remote file input.\n\tRemoteFileConfig *SelectRemoteFileConfig\n\t// SupportedLocations specifies which file locations are available for selection.\n\t// If nil or empty, all locations are supported (Local, S3, GCS, Azure Blob, HTTPS).\n\tSupportedLocations []string\n\t// Mode is SelectFileModeOpen (the default) to choose an existing file, or\n\t// SelectFileModeSave to choose where a new file will be written.\n\tMode SelectFileMode\n\t// DefaultFileName pre-fills the local file path in SelectFileModeSave.\n\tDefaultFileName string\n}\n```\nSelectFileConfig holds configuration for the file selector.\n\n```go\ntype SelectFileErrorMsg struct {\n\tErr error\n}\n```\nSelectFileErrorMsg is sent when there's an error during file selection.\n\n```go\ntype SelectFileLocationMsg struct {\n\tLocation string\n}\n```\nSelectFileLocationMsg is sent when a location has been selected.\n\n```go\ntype SelectFileMode int\n```\nSelectFileMode determines whether the selected file is read or written.\n\n```go\nconst (\n\t// SelectFileModeOpen chooses an existing file to read, with a file picker for local files.\n\tSelectFileModeOpen SelectFileMode = iota\n\t// SelectFileModeSave chooses where a file will be written, with a path input for local\n\t// files so the file does not need to exist yet.\n\tSelectFileModeSave\n)\n```\n\n```go\ntype SelectFileModel struct {\n\t// contains filtered or unexported fields\n}\n```\nSelectFileModel provides a generalized file selection interface that supports both local files and remote storage (S3, GCS, Azure Blob, HTTPS).\n\n```go\nfunc NewSelectFile(config SelectFileConfig) (*SelectFileModel, error)\n```\nNewSelectFile creates a new file selection model.\n\n```go\nfunc (m SelectFileModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectFileModel) SelectedFile() string\n```\nSelectedFile returns the currently selected file path.\n\n```go\nfunc (m SelectFileModel) SelectedLocation() string\n```\nSelectedLocation returns the location type of the selected file.\n\n```go\nfunc (m SelectFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectFileModel) View() string\n```\n\n```go\ntype SelectFileMsg struct {\n\tFile     string\n\tLocation string\n}\n```\nSelectFileMsg is sent when a file has been selected.\n\n```go\ntype SelectFileStartMsg struct {\n\tSelection string\n}\n```\nSelectFileStartMsg is sent when the user makes a selection at the start screen.\n\n```go\ntype SelectLocalFileModel struct {\n\t// contains filtered or unexported fields\n}\n```\nSelectLocalFileModel provides a file picker for selecting local files.\n\n```go\nfunc NewSelectLocalFile(\n\tfp *filepicker.Model,\n\tstyles *stylespkg.Styles,\n\tprompt string,\n\tfileTypeName string,\n) (*SelectLocalFileModel, error)\n```\nNewSelectLocalFile creates a new local file selection model.\n\n```go\nfunc (m SelectLocalFileModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectLocalFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectLocalFileModel) View() string\n```\n\n```go\ntype SelectModel struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSelect(\n\ttitle string,\n\tlistItems []list.Item,\n\tstyles *stylespkg.Styles,\n\tselectCommand func(string) tea.Cmd,\n\tenableFiltering bool,\n) *SelectModel\n```\n\n```go\nfunc (m SelectModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectModel) View() string\n```\n\n```go\ntype SelectRemoteFileConfig struct {\n\t// URLTitle is the title for the HTTPS URL input field.\n\t// Defaults to \"HTTPS resource URL\".\n\tURLTitle string\n\t// URLDescription is the description for the HTTPS URL input field.\n\t// Defaults to \"The public URL of the file to download.\"\n\tURLDescription string\n\t// URLPlaceholder is the placeholder for the HTTPS URL input field.\n\t// Defaults to \"https://assets.example.com/project.blueprint\".\n\tURLPlaceholder string\n\t// BucketNameTitle overrides the bucket name title for a specific location.\n\t// Map keys are location constants (e.g., consts.FileLocationS3).\n\tBucketNameTitle map[string]string\n\t// BucketNameDescription overrides the bucket name description for a specific location.\n\tBucketNameDescription map[string]string\n\t// BucketNamePlaceholder overrides the bucket name placeholder for a specific location.\n\tBucketNamePlaceholder map[string]string\n\t// ObjectPathDescription overrides the object path description for a specific location.\n\tObjectPathDescription map[string]string\n}\n```\nSelectRemoteFileConfig holds configuration for remote file selection.\n\n```go\ntype SelectRemoteFileModel struct {\n\t// contains filtered or unexported fields\n}\n```\nSelectRemoteFileModel provides forms for selecting files from remote locations.\n\n```go\nfunc NewSelectRemoteFile(\n\tinitialFile string,\n\tstyles *stylespkg.Styles,\n\tconfig *SelectRemoteFileConfig,\n) *SelectRemoteFileModel\n```\nNewSelectRemoteFile creates a new remote file selection model.\n\n```go\nfunc (m SelectRemoteFileModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectRemoteFileModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectRemoteFileModel) View() string\n```\n\n```go\ntype SelectWithPreviewModel struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSelectWithPreview(\n\ttitle string,\n\tlistItems []list.Item,\n\tstyles *stylespkg.Styles,\n\tselectCommand func(string) tea.Cmd,\n\tenableFiltering bool,\n) *SelectWithPreviewModel\n```\n\n```go\nfunc (m SelectWithPreviewModel) Init() tea.Cmd\n```\n\n```go\nfunc (m SelectWithPreviewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)\n```\n\n```go\nfunc (m SelectWithPreviewModel) View() string\n```\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/ui","name":"ui","synopsis":"","isRedistributable":true}
