filetree

package
v0.264.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadChildren

func LoadChildren(projectPath, parentPath string, depth int, opts LoadOptions, statuses map[string]GitFileStatus) tea.Cmd

func LoadFileTree

func LoadFileTree(projectPath string, opts LoadOptions) tea.Cmd

func LoadFilteredTree

func LoadFilteredTree(projectPath, query string, opts LoadOptions, statuses map[string]GitFileStatus) tea.Cmd

func LoadGitStatus

func LoadGitStatus(projectPath string) tea.Cmd

Types

type Component

type Component interface {
	tea.Model
	layout.Sizeable
	layout.Bindings
	SelectedFile() string
}

type FileNode

type FileNode struct {
	Name       string
	Path       string
	IsDir      bool
	IsExpanded bool
	Children   []*FileNode
	GitStatus  GitFileStatus
	Depth      int
	Icon       string
	Loaded     bool
}

func NewFileNode

func NewFileNode(name, path string, isDir bool, depth int, status GitFileStatus) *FileNode

func NewRootNode

func NewRootNode(projectPath string) *FileNode

func (*FileNode) SetExpanded

func (n *FileNode) SetExpanded(expanded bool)

type FileSelectedMsg

type FileSelectedMsg struct {
	Path         string
	RelativePath string
}

type FileTree

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

func New

func New(projectPath string, opts ...Option) *FileTree

func (*FileTree) BindingKeys

func (t *FileTree) BindingKeys() []key.Binding

func (*FileTree) GetSize

func (t *FileTree) GetSize() (int, int)

func (*FileTree) Init

func (t *FileTree) Init() tea.Cmd

func (*FileTree) SelectedFile

func (t *FileTree) SelectedFile() string

func (*FileTree) SetSize

func (t *FileTree) SetSize(width, height int) tea.Cmd

func (*FileTree) Update

func (t *FileTree) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FileTree) View

func (t *FileTree) View() string

type FileTreeRefreshMsg

type FileTreeRefreshMsg struct {
	Root *FileNode
	Err  error
}

type FilterResultsMsg

type FilterResultsMsg struct {
	Query string
	Root  *FileNode
	Err   error
}

type GitFileStatus

type GitFileStatus int
const (
	GitStatusClean GitFileStatus = iota
	GitStatusModified
	GitStatusAdded
	GitStatusDeleted
	GitStatusUntracked
	GitStatusRenamed
)

func MergeGitStatus

func MergeGitStatus(current, next GitFileStatus) GitFileStatus

func (GitFileStatus) Priority

func (s GitFileStatus) Priority() int

type GitStatusUpdateMsg

type GitStatusUpdateMsg struct {
	Statuses map[string]GitFileStatus
	Err      error
}

type KeyMap

type KeyMap struct {
	Up           key.Binding
	Down         key.Binding
	Expand       key.Binding
	Collapse     key.Binding
	Open         key.Binding
	Search       key.Binding
	Refresh      key.Binding
	CancelSearch key.Binding
	NewFile      key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type LoadChildrenMsg

type LoadChildrenMsg struct {
	ParentPath string
	Children   []*FileNode
	Err        error
}

type LoadOptions

type LoadOptions struct {
	ShowHidden bool
}

type Option

type Option func(*FileTree)

func WithKeyMap

func WithKeyMap(keys KeyMap) Option

func WithShowHidden

func WithShowHidden(show bool) Option

Jump to

Keyboard shortcuts

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