fileindex

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildIndexInput

type BuildIndexInput struct {
	BaseDirs         []string              // Base directories to search (e.g., ["$HOME"])
	ExcludePaths     []string              // Paths to skip entirely (e.g., ["~/repos", "~/.cache"])
	Patterns         []Pattern             // Patterns to match
	MaxDepth         int                   // Maximum recursion depth (0 = unlimited)
	FollowSymlinks   bool                  // Whether to follow symbolic links
	ProgressCallback func(processed int64) // Optional progress reporter
}

BuildIndexInput holds the input parameters for building a file index

type FileIndex

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

FileIndex holds the results of the file system scan

func BuildIndex

func BuildIndex(ctx context.Context, input BuildIndexInput) (*FileIndex, error)

BuildIndex recursively scans directories and builds a file index with inline matching

func NewFileIndex

func NewFileIndex() *FileIndex

NewFileIndex creates a new empty file index

func (*FileIndex) Add

func (fi *FileIndex) Add(patternName, filePath string)

Add adds a matched file path for a given pattern name

func (*FileIndex) Get

func (fi *FileIndex) Get(patternName string) []string

Get retrieves all file paths matching a pattern name

func (*FileIndex) GetAll

func (fi *FileIndex) GetAll() map[string][]string

GetAll returns all indexed files grouped by pattern name

func (*FileIndex) TotalFiles

func (fi *FileIndex) TotalFiles() int

TotalFiles returns the total number of indexed files

type Pattern

type Pattern struct {
	Name     string      // Unique identifier for this pattern (e.g., "ssh_config")
	Patterns []string    // List of patterns to match (e.g., [".ssh/config", ".ssh/config.d/*"])
	Type     PatternType // Type of pattern matching
}

Pattern defines a file pattern to search for

type PatternType

type PatternType string

PatternType defines the type of pattern matching to use

const (
	PatternTypeGlob  PatternType = "glob"
	PatternTypeExact PatternType = "exact"
	PatternTypeRegex PatternType = "regex" // Reserved for future use
)

Jump to

Keyboard shortcuts

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