config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PairFilters added in v1.1.0

func PairFilters(localRoot string, exclude []string) ([]string, error)

PairFilters combines a pair's config-level exclude patterns with any .driveignore file found at localRoot into a single translated rclone filter-rule list. exclude entries come first, then the .driveignore file's lines - so, under gitignore's last-match-wins semantics, a folder's own .driveignore can override a pattern set in the pair's config. This lets a pair (e.g. a real user directory like ~/.claude) be excluded entirely via config, with no .driveignore file ever written into that directory.

func ResolveRcloneConfig added in v1.1.0

func ResolveRcloneConfig(explicit string) string

ResolveRcloneConfig returns the rclone config path to hand librclone: the explicit value if non-empty, else the first existing default location. The scoop portable rclone.conf (adjacent to the scoop rclone binary) is only found by the rclone CLI, not by librclone's default (%APPDATA%), so probe it first, then %APPDATA%. Returns "" if none exist (librclone falls back to its own default).

func TranslateDriveIgnore

func TranslateDriveIgnore(localRoot string) ([]string, error)

TranslateDriveIgnore reads the .driveignore file at localRoot (if any) and translates it to rclone filter rules. Returns (nil, nil) when no .driveignore file exists.

func TranslateIgnoreLines added in v1.1.0

func TranslateIgnoreLines(lines []string) []string

TranslateIgnoreLines converts a list of gitignore-syntax lines (blank lines and "#" comments are skipped) into rclone filter rules ("+ "/"- " prefixed patterns), ready for a bisync filters file or an rc _filter.FilterRule list.

gitignore: last-match-wins. rclone filter: first-match-wins. The lines are reversed as a whole after translation so later negations (which must win under gitignore semantics) are checked before the rules they negate.

Types

type Config

type Config struct {
	// RcloneConfig is the explicit rclone config file path (e.g. a scoop
	// portable rclone.conf); empty means auto-detect (see ResolveRcloneConfig).
	RcloneConfig string
	Pairs        []Pair `toml:"pair"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

Validate checks every pair independently; N pairs (>= 1) are supported.

type Pair

type Pair struct {
	Local    string
	Remote   string
	Interval time.Duration
	Mode     string
	// Exclude holds config-level gitignore-syntax patterns for this pair,
	// combined with any .driveignore file at Local by PairFilters. Lets a
	// pair (e.g. ~/.claude) exclude paths (node_modules, .venv, caches) from
	// the config itself instead of requiring a .driveignore file dropped
	// into a real user directory.
	Exclude []string
}

Jump to

Keyboard shortcuts

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