Documentation ¶
Overview ¶
© Ben Garrett https://github.com/bengarrett/dupers
Index ¶
- Constants
- Variables
- func Bucket(name string) parse.Bucket
- func Match(path, match string) string
- func Print(quiet, exact bool, term string, m *database.Matches) string
- func PrintRM(path string, err error) string
- func PrintWalk(lookup bool, c *Config) string
- func Removes(w io.Writer, root string, files []fs.DirEntry) ([]string, error)
- func SkipDirs(name string) error
- func SkipFS(dir, file, regular bool, d fs.DirEntry) error
- func SkipFile(name string) bool
- type Config
- func (c *Config) Check(name string) (isdir bool, path string, err error)
- func (c *Config) Checksum(db *bolt.DB, name, bucket string) error
- func (c *Config) Clean(w io.Writer) error
- func (c *Config) Debugger(s string)
- func (c *Config) Print() (string, error)
- func (c *Config) Read(db *bolt.DB, b parse.Bucket, name, mimeExt string) error
- func (c *Config) Read7Zip(db *bolt.DB, b parse.Bucket, name string) error
- func (c *Config) Remove() (string, error)
- func (c *Config) Removes() ([]string, error)
- func (c *Config) StatSource() (isDir bool, files, versus int, err error)
- func (c *Config) Status() string
- func (c *Config) WalkArchiver(db *bolt.DB, name parse.Bucket) error
- func (c *Config) WalkDir(db *bolt.DB, name parse.Bucket) error
- func (c *Config) WalkDirs(db *bolt.DB) error
- func (c *Config) WalkSource() error
- func (c *Config) Writer(w io.Writer, s string)
Constants ¶
const (
WinOS = "windows"
)
Variables ¶
var ( ErrFileEmpty = errors.New("file is empty, being 0 byte in size") ErrNilConfig = errors.New("config cannot be nil") ErrNoMatch = errors.New("no match found") ErrNoNamedBucket = errors.New("a named bucket is required") ErrPathEmpty = errors.New("path is empty") ErrPathIsFile = errors.New("path is a file") ErrPathExist = errors.New("path exists in the database bucket") ErrPathNoFound = errors.New("path does not exist") )
Functions ¶
func Removes ¶
Removes directories that do not contain MS-DOS or Windows programs. The strings contains the path of any undeletable files.
Types ¶
type Config ¶
type Config struct { Debug bool // Debug spams technobabble to stdout. Quiet bool // Quiet the feedback sent to stdout. Yes bool // Yes is assumed for all user questions and prompts. Test bool // Test toggles the internal unit test mode. parse.Scanner }
Config options.
func (*Config) Check ¶
Check stats and returns the named file or directory. If it does not exist, it looks up an absolute path and returns the result. If the item is a file it returns both the named file and an ErrPathIsFile error.
func (*Config) Clean ¶
Clean removes all empty directories from c.Source. Directories containing hidden system directories or files are not considered empty.
func (*Config) Read7Zip ¶
Read7Zip opens the named 7-Zip archive, hashes and saves the content to the bucket.
func (*Config) Removes ¶
Removes the directories from the source that do not contain unique MS-DOS or Windows programs. The strings contains the path of any undeletable files.
func (*Config) StatSource ¶
StatSource returns the number of files in the source directory to check. If the source is a file, files will always equal 1. The returned versus the number of items in the buckets for the dupe check.
func (*Config) WalkArchiver ¶
WalkArchiver walks the bucket directory saving the checksums of new files to the database. Any archived files supported by archiver will also have its content hashed. Archives within archives are currently left unwalked.
func (*Config) WalkDir ¶
WalkDir walks the named bucket directory for any new files to add their checksums to the database.
func (*Config) WalkDirs ¶
WalkDirs walks the named bucket directories for any new files to add their checksums to the database.
func (*Config) WalkSource ¶
WalkSource walks the source directory or a file to collect the hashed content for a future comparison.