config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppDir

func AppDir() string

AppDir returns the root application data directory.

func Dir

func Dir() string

Dir returns the directory where config and other app data live.

func Path

func Path() string

Path returns the full path to config.json.

func Save

func Save(cfg *Config) error

Save persists the config atomically: the JSON is written to <path>.tmp and then renamed into place, so a crash mid-write cannot leave a half-written config.json that Load would refuse to parse.

Types

type Config

type Config struct {
	EnabledCategories  map[string]bool   `json:"enabled_categories"`
	ActivePreset       string            `json:"active_preset"`
	OldInstallerMonths int               `json:"old_installer_months"`
	LargeFileMinSizeMB int               `json:"large_file_min_size_mb"`
	LargeFileMonths    int               `json:"large_file_months"`
	Exclusions         []string          `json:"exclusions"`
	AutoRiskOverrides  map[string]string `json:"auto_risk_overrides"`
	// QuarantineEnabled controls whether cleanups move files to quarantine (true, default)
	// or permanently delete them without recovery (false).
	QuarantineEnabled bool `json:"quarantine_enabled"`
	// QuarantineAutoCleanupDays: 0 = disabled. When > 0, a Windows scheduled task runs
	// `broominal quarantine-cleanup --force --max-age-days N` daily at 03:00.
	QuarantineAutoCleanupDays int    `json:"quarantine_auto_cleanup_days"`
	Language                  string `json:"language"`
}

Config holds user-configurable cleanup rules.

func Default

func Default() *Config

Default returns the built-in default configuration.

func Load

func Load() (*Config, error)

Load reads the config from disk or returns defaults if missing.

func (*Config) ApplyPreset

func (c *Config) ApplyPreset(p Preset)

func (*Config) IsCategoryEnabled

func (c *Config) IsCategoryEnabled(name string) bool

IsCategoryEnabled treats a nil map as "all enabled" so a default-constructed Config works in tests and first-run code paths without explicit init.

func (*Config) IsExcluded

func (c *Config) IsExcluded(path string) bool

IsExcluded matches any single path component against the user's exclusion list. The component-wise check is what makes rules like "node_modules" or "dist" work without users having to spell out full directory paths.

func (*Config) RiskOverrideFor

func (c *Config) RiskOverrideFor(path string) string

RiskOverrideFor returns an override risk for a path, or empty string.

type Preset

type Preset string
const (
	PresetQuick    Preset = "quick"
	PresetStandard Preset = "standard"
	PresetDeep     Preset = "deep"
)

Jump to

Keyboard shortcuts

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