progress

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      EventType
	Path      string
	Name      string
	Tech      string
	Info      string
	Reason    string
	FileCount int
	DirCount  int
	Duration  time.Duration
	Timestamp time.Time // For timing calculations
	Matched   bool      // For rule matching results
	Details   []string  // For detailed rule check information
}

Event represents something that happened during scanning

type EventType

type EventType int

EventType represents the type of progress event

const (
	EventScanStart EventType = iota
	EventScanComplete
	EventEnterDirectory
	EventLeaveDirectory
	EventComponentDetected
	EventFileProcessingStart
	EventFileProcessingEnd
	EventFolderFileProcessingStart
	EventFolderFileProcessingEnd
	EventSkipped
	EventProgress
	EventScanInitializing
	EventFileWriting
	EventFileWritten
	EventInfo
	EventRuleCheck
	EventRuleResult
	EventGitIgnoreEnter
	EventGitIgnoreLeave
)

type Handler

type Handler interface {
	Handle(event Event)
}

Handler processes events and produces output

type NullHandler

type NullHandler struct{}

NullHandler discards all events (for disabled verbose mode)

func NewNullHandler

func NewNullHandler() *NullHandler

func (*NullHandler) Handle

func (h *NullHandler) Handle(event Event)

type Progress

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

Progress manages scan progress reporting with different handlers

func New

func New(enabled bool, handler Handler) *Progress

New creates a new progress reporter

func (*Progress) ComponentDetected

func (p *Progress) ComponentDetected(name, tech, path string)

func (*Progress) EnableRuleTracing

func (p *Progress) EnableRuleTracing()

EnableRuleTracing enables detailed rule matching information

func (*Progress) EnableTimings

func (p *Progress) EnableTimings()

EnableTimings enables timing information in progress output

func (*Progress) EnterDirectory

func (p *Progress) EnterDirectory(path string)

EnterDirectory reports entering a directory (timing tracked via FolderFileProcessing events)

func (*Progress) FileProcessing

func (p *Progress) FileProcessing(path, info string)

func (*Progress) FileProcessingEnd

func (p *Progress) FileProcessingEnd(path string)

func (*Progress) FileWriting

func (p *Progress) FileWriting(path string)

func (*Progress) FileWritten

func (p *Progress) FileWritten(path string)

func (*Progress) FolderFileProcessingEnd

func (p *Progress) FolderFileProcessingEnd(path string)

func (*Progress) FolderFileProcessingStart

func (p *Progress) FolderFileProcessingStart(path string)

func (*Progress) GitIgnoreEnter

func (p *Progress) GitIgnoreEnter(path string)

func (*Progress) GitIgnoreLeave

func (p *Progress) GitIgnoreLeave(path string)

func (*Progress) Info

func (p *Progress) Info(message string)

func (*Progress) LeaveDirectory

func (p *Progress) LeaveDirectory(path string)

LeaveDirectory reports leaving a directory

func (*Progress) ProgressUpdate

func (p *Progress) ProgressUpdate(files, dirs int)

func (*Progress) Report

func (p *Progress) Report(event Event)

Report sends an event to the handler (only if enabled)

func (*Progress) RuleCheck

func (p *Progress) RuleCheck(tech string, details []string)

func (*Progress) RuleResult

func (p *Progress) RuleResult(tech string, matched bool, reason string)

func (*Progress) RuleResultWithPath

func (p *Progress) RuleResultWithPath(tech string, matched bool, reason string, path string)

func (*Progress) ScanComplete

func (p *Progress) ScanComplete(files, _ int, duration time.Duration)

func (*Progress) ScanInitializing

func (p *Progress) ScanInitializing(path string, excludePatterns []string)

func (*Progress) ScanStart

func (p *Progress) ScanStart(path string, excludePatterns []string)

func (*Progress) Skipped

func (p *Progress) Skipped(path, reason string)

type Reporter

type Reporter interface {
	Report(event Event)
}

Reporter is the interface the scanner uses to report events

type RuleEntry

type RuleEntry struct {
	Tech    string
	Reason  string
	Path    string
	Matched bool
}

RuleEntry represents a rule match for analysis

type SimpleHandler

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

SimpleHandler outputs events as simple lines (no tree)

func NewSimpleHandler

func NewSimpleHandler(writer io.Writer) *SimpleHandler

func (*SimpleHandler) Handle

func (h *SimpleHandler) Handle(event Event)

type TimingEntry

type TimingEntry struct {
	Path     string
	Duration time.Duration
	Depth    int
}

TimingEntry represents a directory timing for analysis

type TreeHandler

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

TreeHandler outputs events with tree-like visualization

func NewTreeHandler

func NewTreeHandler(writer io.Writer) *TreeHandler

func (*TreeHandler) Handle

func (h *TreeHandler) Handle(event Event)

Jump to

Keyboard shortcuts

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