filetree

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package filetree implements the file explorer panel for grut. It provides a navigable tree view of the filesystem with lazy directory loading, symlink safety, icon support, and cursor-based navigation.

Package filetree provides the file tree panel for grut.

Package filetree provides file operation helpers for the grut file explorer. All operations validate that paths stay within the tree's root directory (path jailing) to prevent directory-traversal attacks.

Package filetree provides a filesystem watcher for the grut file explorer. It uses fsnotify for event-based watching with a debounce window, and falls back to polling when fsnotify is unavailable or fails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirChangedMsg

type DirChangedMsg struct{ Path string }

Messages emitted by the filetree panel. DirChangedMsg is sent when a directory is expanded.

type FileTree

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

FileTree is the file explorer panel. It implements panels.Panel.

func New

func New(cfg config.FileTreeConfig, rootPath string) *FileTree

New creates a new FileTree panel rooted at rootPath.

func (*FileTree) Blur

func (ft *FileTree) Blur()

Blur implements panels.Panel.

func (*FileTree) Close

func (ft *FileTree) Close()

Close implements panels.Closer. It stops the filesystem watcher and releases associated resources (F29).

func (*FileTree) Focus

func (ft *FileTree) Focus()

Focus implements panels.Panel.

func (*FileTree) Init

func (ft *FileTree) Init(ctx context.Context) tea.Cmd

--------------------------------------------------------------------------- panels.Panel interface --------------------------------------------------------------------------- Init implements panels.Panel.

func (*FileTree) KeyBindings

func (ft *FileTree) KeyBindings() []panels.KeyBinding

KeyBindings implements panels.Panel.

func (*FileTree) SetActionsCfg

func (ft *FileTree) SetActionsCfg(cfg config.ActionsConfig)

SetActionsCfg stores the actions configuration for right-click menus.

func (*FileTree) SetGitClient

func (ft *FileTree) SetGitClient(gc git.StatusReader)

SetGitClient configures the filetree with a git client for git-aware filtering. When set, the user can press "g" to toggle between all files and only git-changed files.

func (*FileTree) SetSize

func (ft *FileTree) SetSize(width, height int)

SetSize implements panels.Panel.

func (*FileTree) Title

func (ft *FileTree) Title() string

Title implements panels.Panel.

func (*FileTree) Update

func (ft *FileTree) Update(msg tea.Msg) (panels.Panel, tea.Cmd)

Update implements panels.Panel.

func (*FileTree) View

func (ft *FileTree) View(width, height int) string

View implements panels.Panel.

type RefreshMsg

type RefreshMsg struct{}

RefreshMsg tells the filetree to reload its directory listing.

Jump to

Keyboard shortcuts

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