files

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package files provides filesystem enumeration helpers for the file explorer overlay. It sits alongside session/git rather than inside it because the callers may operate on non-git roots (workspace terminals pointed at bare directories), and because these helpers are stateless path-only operations — session/git is organized around stateful GitWorktree lifecycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListResult

type ListResult struct {
	Root    string
	Paths   []string
	FromGit bool
}

ListResult describes the enumeration output.

Paths are relative to Root, alphabetically sorted. FromGit distinguishes the two code paths so callers (and tests) can assert which route fired without inspecting logs.

func List

func List(root string) (ListResult, error)

List enumerates files under root. When root is a git repository it prefers `git ls-files --cached --others --exclude-standard -z`, which respects .gitignore while still surfacing newly-created untracked files — the workflow the file explorer targets. On a non-git root or when git exits with an error, it falls back to filepath.WalkDir, pruning .git directories and skipping symlinks.

An empty root is rejected because the walk fallback would happily enumerate the current working directory, which is almost never what the caller wants.

Jump to

Keyboard shortcuts

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