api

package
v0.0.0-...-7ec61c6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDir

func DeleteDir(dir string) error

Deletes an entire directory

func GetDirSize

func GetDirSize(dir string) int64

Types

type Config

type Config struct {
	Predicates []Predicate
}

func ParseConfig

func ParseConfig(content string) (*Config, error)

type DirIterator

type DirIterator struct {
	CurrentDirContent []fs.DirEntry
	CurrentDir        string
	NextDirs          []string
	Predicates        []Predicate
	PredicateIndex    int
	Ignore            []string
}

The state of a directory iterator, which keeps track of the current directory content, and the next directories that can be searched

func NewDirIterator

func NewDirIterator(dir string, pairs []Predicate, ignore []string) *DirIterator

Travserses a directory, and yields all files that should be deleted, based on the predicate-folder pairs passed in

func (*DirIterator) Next

func (d *DirIterator) Next() (string, error)

type Predicate

type Predicate struct {
	Predicate func(string) bool
	Folder    string
	Match     bool
}

Struct that represents one predicate-folder pair, which allows us to only search for certain folders within a given directory when a certain file exists (e.g. package.json with node_modules)

type RawConfig

type RawConfig struct {
	Predicates []RawPredicate `toml:"sweep"`
}

type RawPredicate

type RawPredicate struct {
	Predicate []string
	Folder    string
}

Jump to

Keyboard shortcuts

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