scanner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilePathLess

func FilePathLess(left, right string) bool

func SortEntries

func SortEntries(entries []*TreeEntry)

func SortFiles

func SortFiles(entries []*TreeEntry)

Types

type DecisionStatus

type DecisionStatus string
const (
	StatusPending DecisionStatus = "pending"
	StatusKeep    DecisionStatus = "keep"
	StatusDrop    DecisionStatus = "drop"
)

type EntryKind

type EntryKind string
const (
	EntryFile EntryKind = "file"
	EntryDir  EntryKind = "dir"
)

type ScanOptions

type ScanOptions struct {
	Root             string
	IncludePatterns  []string
	ExcludePatterns  []string
	UseGitIgnore     bool
	ApplySafetyRules bool
	Logger           *slog.Logger
	OnWarning        func(Warning)
}

type Tree

type Tree struct {
	Root     string
	RootName string
	Entries  []*TreeEntry
	Files    []*TreeEntry
}

func ScanAll

func ScanAll(ctx context.Context, opts ScanOptions) (*Tree, error)

type TreeEntry

type TreeEntry struct {
	ID         int
	Kind       EntryKind
	Name       string
	RelPath    string
	AbsPath    string
	Depth      int
	SizeBytes  int64
	ParentPath string
	Status     DecisionStatus
	IsScanned  bool
	Children   []*TreeEntry
}

func ScanChildren

func ScanChildren(ctx context.Context, root string, parentRelPath string, opts ScanOptions) ([]*TreeEntry, error)

type Warning

type Warning struct {
	Kind WarningKind
	Path string
	Err  error
}

func (Warning) Message

func (w Warning) Message() string

type WarningKind

type WarningKind string
const (
	WarningUnreadablePath     WarningKind = "unreadable_path"
	WarningUnreadableMetadata WarningKind = "unreadable_metadata"
	WarningSecretLikeFile     WarningKind = "secret_like_file"
	WarningUnreadableFile     WarningKind = "unreadable_file"
)

Jump to

Keyboard shortcuts

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