scanner

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangedFiles

func ChangedFiles(root, sinceCommit string) ([]string, error)

ChangedFiles returns file paths changed between sinceCommit and HEAD.

func CurrentCommit

func CurrentCommit(root string) (string, error)

CurrentCommit returns the HEAD commit hash for the repo at root.

func IsGitRepo

func IsGitRepo(root string) bool

IsGitRepo checks whether a .git directory exists at the given root.

func LangForExt

func LangForExt(ext string) string

LangForExt returns the language for a file extension, or empty string if unsupported.

Types

type FileInfo

type FileInfo struct {
	Path     string
	Language string
	RelPath  string
}

FileInfo holds metadata about a discovered source file.

type Matcher

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

Matcher loads .gitignore patterns and checks paths against them.

func NewMatcher

func NewMatcher(root string) *Matcher

NewMatcher creates a Matcher by loading .gitignore from the given root directory.

func (*Matcher) IsIgnored

func (m *Matcher) IsIgnored(relPath string) bool

IsIgnored returns true if the given path (relative to root) should be ignored.

type Scanner

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

Scanner walks a directory tree to find supported source files.

func NewScanner

func NewScanner(root string) *Scanner

NewScanner creates a Scanner for the given root directory.

func (*Scanner) ScanAll

func (s *Scanner) ScanAll() ([]FileInfo, error)

ScanAll walks the directory tree and returns all supported source files, skipping ignored paths and directories starting with '.' or '_'.

Jump to

Keyboard shortcuts

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