filepicker

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package filepicker provides a file picker component (stub replacement for charm.land/bubbles/v2/filepicker).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Back   key.Binding
	Select key.Binding
}

KeyMap defines keybindings.

type Model

type Model struct {
	// Exported fields for compatibility
	CurrentDirectory string
	AllowedTypes     []string
	ShowPermissions  bool
	ShowSize         bool
	AutoHeight       bool
	Cursor           string
	Styles           Styles
	KeyMap           KeyMap
	// contains filtered or unexported fields
}

Model is a file picker component.

func New

func New() Model

New creates a new file picker.

func (Model) CurrentDir

func (m Model) CurrentDir() string

CurrentDir returns the current directory.

func (Model) DidSelectFile

func (m Model) DidSelectFile(msg tea.Msg) (bool, string)

DidSelectFile returns true if a file was selected in this update.

func (Model) HighlightedPath

func (m Model) HighlightedPath() string

HighlightedPath returns the path of the currently highlighted item.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model.

func (Model) Selected

func (m Model) Selected() string

Selected returns the selected file path.

func (*Model) SetHeight

func (m *Model) SetHeight(h int)

SetHeight sets the picker height.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the picker size.

func (*Model) SetStyles

func (m *Model) SetStyles(s Styles)

SetStyles sets the styles.

func (Model) Update

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

Update handles messages.

func (Model) View

func (m Model) View() string

View renders the file picker.

type Option

type Option func(*Model)

Option configures the file picker.

func WithAllowedTypes

func WithAllowedTypes(types []string) Option

WithAllowedTypes sets allowed file types.

func WithCurrentDir

func WithCurrentDir(dir string) Option

WithCurrentDir sets the current directory.

func WithDirOnly

func WithDirOnly(dirOnly bool) Option

WithDirOnly shows only directories.

func WithFileAllowed

func WithFileAllowed(allowed bool) Option

WithFileAllowed allows file selection.

func WithHeight

func WithHeight(h int) Option

WithHeight sets the picker height.

func WithShowHidden

func WithShowHidden(show bool) Option

WithShowHidden shows hidden files.

func WithStyles

func WithStyles(s Styles) Option

WithStyles sets the styles.

type Styles

type Styles struct {
	Cursor           lipgloss.Style
	Symlink          lipgloss.Style
	Directory        lipgloss.Style
	File             lipgloss.Style
	Permission       lipgloss.Style
	Selected         lipgloss.Style
	DisabledCursor   lipgloss.Style
	DisabledFile     lipgloss.Style
	DisabledSelected lipgloss.Style
	EmptyDirectory   lipgloss.Style
	FileSize         lipgloss.Style
}

Styles configures file picker appearance.

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns default styles.

Jump to

Keyboard shortcuts

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