Help us shape the future of Go! Take the 2026 Go Developer Survey

planner

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveDate added in v0.8.0

func ResolveDate(file models.File, source string) (time.Time, bool)

ResolveDate picks the calendar date a file is filed under, honoring the same date sources the planner supports for sorting. It is exported so other commands (chest rename) can reuse the exact same date semantics instead of re-implementing them: an empty or unknown source behaves as "modified".

Types

type Option added in v0.4.0

type Option func(*Planner)

Option configures planner behavior without changing the existing constructor signature.

func WithDate added in v0.4.0

func WithDate(source, granularity, monthFormat string) Option

WithDate configures date placeholders and generated date sorting. monthFormat is "name" (Jan) or "number" (01); anything else behaves as "name".

func WithHashCollisions added in v0.8.0

func WithHashCollisions() Option

WithHashCollisions turns on content-aware conflict resolution. Only the files that actually collide on a destination are hashed, never the whole tree: a genuine duplicate (identical SHA-256) is left in place instead of being auto-renamed, while distinct content keeps the normal auto-rename. Without this option no file is opened and planning is byte-for-byte the behavior it has always had.

type Planner

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

Planner builds the filesystem execution plan

func New

func New(engine *rules.Engine, baseDestination string, collisionPolicy models.CollisionPolicy, opts ...Option) *Planner

New creates a new Planner

func NewFlat added in v0.3.0

func NewFlat(engine *rules.Engine, baseDestination string, collisionPolicy models.CollisionPolicy, opts ...Option) *Planner

NewFlat creates a Planner that routes all matches directly into baseDestination, without appending each rule's category folder.

func (*Planner) Plan

func (p *Planner) Plan(root string, files []models.File) (models.Plan, error)

Plan creates the proposed set of operations

Jump to

Keyboard shortcuts

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