ops

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DuplNuke         = false
	RecurseLevel int = 1 << 10
)
View Source
var (
	ErrAlreadyUndone = errors.New("last operation already undone")
	ErrNoHistory     = errors.New("no recorded operation found for this directory")
)

Functions

func ApplyOperations

func ApplyOperations(rootDir string, operations []core.FileOperation, executor *Executor, reporter *Reporter) (*core.SortResult, error)

func ApplyOperationsCtx

func ApplyOperationsCtx(ctx context.Context, rootDir string, operations []core.FileOperation, executor *Executor, reporter *Reporter) (*core.SortResult, error)

func ApplyOperationsCtxFS

func ApplyOperationsCtxFS(ctx context.Context, rootDir string, operations []core.FileOperation, executor *Executor, reporter *Reporter, fs core.FileSystem) (*core.SortResult, error)

func ApplyOperationsWithFS

func ApplyOperationsWithFS(rootDir string, operations []core.FileOperation, executor *Executor, reporter *Reporter, fs core.FileSystem) (*core.SortResult, error)

func FilterFiles

func FilterFiles(rootDir string, sorter core.Sorter, executor *Executor, reporter *Reporter) (*core.SortResult, error)

func GetHistory

func GetHistory() ([]core.Transaction, error)

func LogToHistory

func LogToHistory(transaction core.Transaction) error

func PlanOperations

func PlanOperations(rootDir string, sorter core.Sorter) ([]core.FileOperation, error)

func PlanOperationsWithIgnore

func PlanOperationsWithIgnore(rootDir string, sorter core.Sorter, ignoreMatcher *ignore.IgnoreMatcher) ([]core.FileOperation, error)

func PlanOperationsWithIgnoreCtx

func PlanOperationsWithIgnoreCtx(ctx context.Context, rootDir string, sorter core.Sorter, ignoreMatcher *ignore.IgnoreMatcher) ([]core.FileOperation, error)

func RunSorter

func RunSorter(ctx context.Context, dir string, sorter core.Sorter, ignorePatterns []string) error

func TopLargestFiles

func TopLargestFiles(rootDir string, n int) error

func Undo

func Undo(path string) error

func WalkFiles

func WalkFiles(rootDir string, fn func(core.FileEntry) error) error

func WalkFilesWithIgnore

func WalkFilesWithIgnore(rootDir string, ignoreMatcher *ignore.IgnoreMatcher, fn func(core.FileEntry) error) error

func WalkFilesWithIgnoreCtx

func WalkFilesWithIgnoreCtx(ctx context.Context, rootDir string, ignoreMatcher *ignore.IgnoreMatcher, fn func(core.FileEntry) error) error

Types

type Executor

type Executor struct {
	FS         core.FileSystem
	Operations []core.FileOperation
}

func (*Executor) Execute

func (e *Executor) Execute(op core.FileOperation) (bool, error)

func (*Executor) ExecuteWithSrc

func (e *Executor) ExecuteWithSrc(op core.FileOperation, src string) (bool, error)

type Reporter

type Reporter struct{}

func (*Reporter) Report

func (r *Reporter) Report(op core.FileOperation, err error)

Jump to

Keyboard shortcuts

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