hiiragi

package module
v0.0.0-...-c106708 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 20 Imported by: 0

README

Hiiragi

Hiiragi is a command line tool to create hard links for duplicate files that are under the specified directory.

GitHub Actions Appveyor Codecov

Installation

$ go install github.com/hattya/hiiragi/cmd/hrg@latest

Usage

$ hrg .

License

Hiiragi is distributed under the terms of the MIT License.

Documentation

Index

Constants

View Source
const Version = "0.0+"

Variables

This section is empty.

Functions

func Link(oldname, newname string) error

func SameAttrs

func SameAttrs(fi1, fi2 FileInfoEx) bool

func SameFile

func SameFile(fi1, fi2 FileInfoEx) bool

func Sum

func Sum(name string) (hash string, err error)

Types

type DB

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

func Create

func Create(name string) (*DB, error)

func Open

func Open(name string) (*DB, error)

func (*DB) Begin

func (db *DB) Begin() error

func (*DB) Close

func (db *DB) Close() error

func (*DB) Commit

func (db *DB) Commit() error

func (*DB) Done

func (db *DB) Done(path string) error

func (*DB) NextFiles

func (db *DB) NextFiles(ctx context.Context, mtime bool, order Order) ([]*File, error)
func (db *DB) NextSymlinks(ctx context.Context, mtime bool, order Order) ([]*Symlink, error)

func (*DB) NumFiles

func (db *DB) NumFiles() (int64, int64, error)
func (db *DB) NumSymlinks() (int64, int64, error)

func (*DB) Rollback

func (db *DB) Rollback() error

func (*DB) SetCacheSize

func (db *DB) SetCacheSize(size int64) error

func (*DB) Update

func (db *DB) Update(fi FileInfoEx) error

type Deduper

type Deduper struct {
	Attrs    bool
	Mtime    When
	Name     bool
	Pretend  bool
	Progress bool
	// contains filtered or unexported fields
}

func NewDeduper

func NewDeduper(ui *cli.CLI, db *DB) *Deduper

func (*Deduper) All

func (d *Deduper) All(ctx context.Context) error

func (*Deduper) Files

func (d *Deduper) Files(ctx context.Context) error
func (d *Deduper) Symlinks(ctx context.Context) error

type File

type File struct {
	Path  string
	Dev   uint64
	Nlink uint64
	Mtime time.Time
	Size  int64
}

type FileInfoEx

type FileInfoEx interface {
	fs.FileInfo

	Path() string
	Dev() (uint64, error)
	Nlink() (uint64, error)
}

func Lstat

func Lstat(name string) (FileInfoEx, error)

func Stat

func Stat(name string) (FileInfoEx, error)

type Finder

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

func NewFinder

func NewFinder(ui *cli.CLI, db *DB) *Finder

func (*Finder) Close

func (f *Finder) Close()

func (*Finder) Walk

func (f *Finder) Walk(ctx context.Context, root string) error

type Order

type Order uint
const (
	Asc Order = iota
	Desc
)
type Symlink struct {
	Path   string
	Dev    uint64
	Nlink  uint64
	Mtime  time.Time
	Target string
}

type When

type When uint
const (
	Oldest When = 1 + iota
	Latest
)

func (When) String

func (w When) String() string

Directories

Path Synopsis
cmd
hrg

Jump to

Keyboard shortcuts

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