flag

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOverrides

func ApplyOverrides(cfg *config.Config, f Options)

ApplyOverrides merges CLI flag values into a loaded Config struct.

Types

type Options

type Options struct {
	LogFormat  logging.LogFormat // LogFormat determines the output format (e.g. text or JSON) for logging.
	ConfigFile string            // ConfigFile is the path to the YAML configuration file for snapraid-runner.
	DryRun     bool              // DryRun, when true, skips actual sync/scrub/smart steps (simulates only).
	Verbose    bool              // Verbose, when true, enables verbose logging output.
	OutputDir  string            // OutputDir is the directory where JSON result files will be written (if non-empty).
	NoNotify   bool              // NoNotify disables Slack notifications when true.
	Steps      StepsOptions      // Steps contains which SnapRAID subcommands ("touch", "scrub", "smart") to execute.
	Thresholds ThresholdOptions  // Thresholds contains which threshold checks (add/remove/update/…) are enabled.
	ScrubPlan  int               // ScrubPlan is the percentage (0–100) passed to the "scrub" subcommand.
	ScrubOlder int               // ScrubOlder is the "older-than" age (in days) passed to the "scrub" subcommand.
}

Options holds all configuration values parsed from CLI flags.

func ParseFlags

func ParseFlags(args []string, version string) (Options, error)

ParseFlags parses CLI flags into a structured Options instance. It also handles --help and --version, returning a HelpRequested error when appropriate.

func (Options) Validate

func (o Options) Validate() error

Validate ensures that the specified configuration file exists on disk.

type StepsOptions

type StepsOptions struct {
	NoTouch bool // Touch enables the "snapraid touch" step.
	NoScrub bool // Scrub enables the "snapraid scrub" step.
	NoSmart bool // Smart enables the "snapraid smart" step.
}

StepsOptions defines which SnapRAID subcommands ("touch", "scrub", "smart") should run.

type ThresholdOptions

type ThresholdOptions struct {
	NoAdd     bool // Add controls whether the "added files" threshold check is active.
	NoRemove  bool // Remove controls whether the "removed files" threshold check is active.
	NoUpdate  bool // Update controls whether the "updated files" threshold check is active.
	NoCopy    bool // Copy controls whether the "copied files" threshold check is active.
	NoMove    bool // Move controls whether the "moved files" threshold check is active.
	NoRestore bool // Restore controls whether the "restored files" threshold check is active.
}

ThresholdOptions defines which threshold checks are enabled or disabled.

Jump to

Keyboard shortcuts

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