parse

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

© Ben Garrett https://github.com/bengarrett/dupers

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSource = errors.New("cannot use an empty source")

Functions

func Contains

func Contains(find string, s ...string) bool

Contains returns true if find exists in s.

func Executable

func Executable(root string) (bool, error)

Executable returns true if the root directory contains an MS-DOS or Windows program file.

func Marker

func Marker(file database.Filepath, term string, exact bool) string

Marker uses ANSI color to highlight the term contained in the filepath.

func Print

func Print(quiet, exact bool, term string, m *database.Matches) string

Print the results of the database comparisons.

Types

type Bucket

type Bucket string // Bucket is a database table named as an absolute directory path.

type Checksum

type Checksum [32]byte // Checksum is a SHA-1 hash file value.

func Read

func Read(name string) (Checksum, error)

Read the named file to return a SHA256 checksum of it's data.

type Checksums

type Checksums map[Checksum]string // Checksums is a collection of SHA-1 hash file values.

type Scanner

type Scanner struct {
	Sources []string  // Sources to compare, either directories or files.
	Buckets []Bucket  // Buckets to lookup.
	Compare Checksums // Compare hashes fetched from the database or file system.
	Files   int       // Files counter of the totals scanned and processed.
	// contains filtered or unexported fields
}

func (*Scanner) BucketS

func (p *Scanner) BucketS() string

BucketS returns a list of buckets used by the database.

func (*Scanner) Compares

func (p *Scanner) Compares() int

Compares returns the number of items in the Compare Scanner.

func (*Scanner) GetSource

func (p *Scanner) GetSource() string

GetSource returns the directory or file to check.

func (*Scanner) SetAllBuckets

func (p *Scanner) SetAllBuckets(db *bolt.DB) error

SetAllBuckets sets all the database buckets for use with the dupe or search commands.

func (*Scanner) SetBuckets

func (p *Scanner) SetBuckets(names ...string) error

SetBuckets adds the bucket name to a list of buckets.

func (*Scanner) SetCompares

func (p *Scanner) SetCompares(db *bolt.DB, name Bucket) (int, error)

SetCompares fetches item names an checksums from the named bucket and stores them in the Compare Scanner.

func (*Scanner) SetSource

func (p *Scanner) SetSource(name string) error

SetSource sets the named string as the directory or file to check.

func (*Scanner) SetTimer

func (p *Scanner) SetTimer()

SetTimer starts a process timer.

func (*Scanner) Timer

func (p *Scanner) Timer() time.Duration

Timer returns the time taken since the process timer was instigated.

Jump to

Keyboard shortcuts

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