filepicker

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvancedModel added in v0.0.21

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

AdvancedModel represents the advanced file picker model

func New added in v0.0.21

func New(options ...Option) *AdvancedModel

New creates a new file picker with the specified options

func NewAdvancedModel added in v0.0.21

func NewAdvancedModel(startPath string) *AdvancedModel

NewAdvancedModel creates a new advanced file picker Deprecated: Use New(WithStartPath(startPath)) instead

func (*AdvancedModel) FullHelpForMode added in v0.0.21

func (fp *AdvancedModel) FullHelpForMode() [][]key.Binding

FullHelpForMode returns keybindings for the expanded help view based on the current mode

func (*AdvancedModel) GetDirectorySelectionMode added in v0.0.21

func (fp *AdvancedModel) GetDirectorySelectionMode() bool

GetDirectorySelectionMode returns whether directory selection mode is enabled

func (*AdvancedModel) GetError added in v0.0.21

func (fp *AdvancedModel) GetError() error

GetError returns any error that occurred

func (*AdvancedModel) GetSelected added in v0.0.21

func (fp *AdvancedModel) GetSelected() ([]string, bool)

GetSelected returns the selected file paths

func (*AdvancedModel) Init added in v0.0.21

func (fp *AdvancedModel) Init() tea.Cmd

Init initializes the file picker

func (*AdvancedModel) IsDirectorySelectionMode added in v0.0.21

func (fp *AdvancedModel) IsDirectorySelectionMode() bool

IsDirectorySelectionMode returns whether directory selection mode is enabled

func (*AdvancedModel) SetDirectorySelectionMode added in v0.0.21

func (fp *AdvancedModel) SetDirectorySelectionMode(enabled bool)

SetDirectorySelectionMode enables or disables directory selection mode

func (*AdvancedModel) SetShowHidden added in v0.0.21

func (fp *AdvancedModel) SetShowHidden(show bool)

SetShowHidden sets whether to show hidden files

func (*AdvancedModel) SetShowPreview added in v0.0.21

func (fp *AdvancedModel) SetShowPreview(show bool)

SetShowPreview sets whether to show file preview

func (*AdvancedModel) SetSize added in v0.0.21

func (fp *AdvancedModel) SetSize(width, height int)

SetSize sets the width and height of the file picker

func (*AdvancedModel) Update added in v0.0.21

func (fp *AdvancedModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for Tier 4

func (*AdvancedModel) View added in v0.0.21

func (fp *AdvancedModel) View() string

View renders the advanced file picker (Tier 4)

type CancelFilePickerMsg

type CancelFilePickerMsg struct{}

type CompatFilepicker added in v0.0.21

type CompatFilepicker struct {
	DirAllowed       bool
	FileAllowed      bool
	CurrentDirectory string
	Height           int
	// contains filtered or unexported fields
}

CompatFilepicker provides compatibility with the old bubbles filepicker interface

type File added in v0.0.21

type File struct {
	Name     string
	Path     string
	IsDir    bool
	Size     int64
	ModTime  time.Time
	Mode     os.FileMode
	Selected bool
	Hidden   bool
}

File represents a file or directory with extended metadata

type Model

type Model struct {
	*AdvancedModel

	// Compatibility fields
	Title        string
	Error        string
	Filepicker   CompatFilepicker
	SelectedPath string
	// contains filtered or unexported fields
}

Model provides backward compatibility with the original bobatea filepicker API

func NewModel

func NewModel() Model

NewModel creates a new file picker with backward compatibility This maintains the original bobatea API while using the advanced implementation

func NewModelWithOptions added in v0.0.21

func NewModelWithOptions(options ...Option) Model

NewModelWithOptions creates a new file picker with backward compatibility using options

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the compatibility wrapper

func (Model) Update

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

Update handles updates for the compatibility wrapper

func (Model) View

func (m Model) View() string

View renders the compatibility wrapper

type Operation added in v0.0.21

type Operation int

Operation represents file operations

const (
	OpNone Operation = iota
	OpCopy
	OpCut
)

type Option added in v0.0.21

type Option func(*AdvancedModel)

Option represents a configuration option for the file picker

func WithCompatibilityMode added in v0.0.21

func WithCompatibilityMode(compat bool) Option

WithCompatibilityMode enables compatibility mode (no additional effect currently)

func WithDetailedView added in v0.0.21

func WithDetailedView(detailed bool) Option

WithDetailedView sets whether to show detailed file information

func WithDirectorySelection added in v0.0.21

func WithDirectorySelection(enabled bool) Option

WithDirectorySelection enables or disables directory selection mode

func WithGlobPattern added in v0.0.21

func WithGlobPattern(pattern string) Option

WithGlobPattern sets the initial glob pattern filter

func WithJailDirectory added in v0.0.21

func WithJailDirectory(path string) Option

WithJailDirectory sets a directory restriction boundary - navigation will be limited to this directory and subdirectories

func WithMaxHistorySize added in v0.0.21

func WithMaxHistorySize(size int) Option

WithMaxHistorySize sets the maximum number of history entries

func WithPreviewWidth added in v0.0.21

func WithPreviewWidth(width int) Option

WithPreviewWidth sets the width of the preview panel

func WithShowHidden added in v0.0.21

func WithShowHidden(show bool) Option

WithShowHidden sets whether to show hidden files

func WithShowIcons added in v0.0.21

func WithShowIcons(show bool) Option

WithShowIcons sets whether to show file icons

func WithShowPreview added in v0.0.21

func WithShowPreview(show bool) Option

WithShowPreview sets whether to show file preview

func WithShowSizes added in v0.0.21

func WithShowSizes(show bool) Option

WithShowSizes sets whether to show file sizes

func WithSortMode added in v0.0.21

func WithSortMode(mode SortMode) Option

WithSortMode sets the initial sort mode

func WithStartPath added in v0.0.21

func WithStartPath(path string) Option

WithStartPath sets the starting directory path

type SelectFileMsg

type SelectFileMsg struct {
	Path string
}

Messages for compatibility with existing bobatea filepicker API

type SortMode added in v0.0.21

type SortMode int

SortMode represents different sorting options

const (
	SortByName SortMode = iota
	SortBySize
	SortByDate
	SortByType
)

type ViewState added in v0.0.21

type ViewState int

ViewState represents the current state of the file picker

const (
	ViewStateNormal ViewState = iota
	ViewStateConfirmDelete
	ViewStateRename
	ViewStateCreateFile
	ViewStateCreateDir
	ViewStateSearch
	ViewStateGlob
)

Jump to

Keyboard shortcuts

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