config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config handles CLI flag parsing, TOML config loading, and validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitFileConfig added in v0.3.0

type CommitFileConfig struct {
	Provider *string `toml:"provider"`
	Model    *string `toml:"model"`
}

CommitFileConfig holds commit-related config file settings.

type Config

type Config struct {
	BaseRef          string            // --base
	HeadRef          string            // --head
	Mode             model.CompareMode // from config file; default: CompareThreeDot
	IgnoreWhitespace bool              // from config file; default: false

	Watch         bool          // default: true; --no-watch disables
	WatchInterval time.Duration // from config file; default: 2s, min: 500ms

	Commit         bool   // --commit
	CommitProvider string // from config file; default: "claude"
	CommitModel    string // from config file; default: ""
	CommitAuto     bool   // --commit-auto (requires --commit)

	NoDashboard      bool // --no-dashboard; forces diff mode even with multiple worktrees
	GroupByDirectory bool // from config file; default: false
}

Config is the resolved configuration threaded into app bootstrap.

func Parse

func Parse(args []string, opts ...ParseOption) (Config, error)

Parse parses CLI args and merges with TOML config files. Precedence: CLI flag > repo .scry.toml > user ~/.config/scry/config.toml > defaults.

func (Config) ShouldUseDashboard added in v0.3.0

func (c Config) ShouldUseDashboard(worktreeCount int) bool

ShouldUseDashboard decides whether to enter dashboard mode based on worktree count and flag state.

type DiffFileConfig added in v0.3.0

type DiffFileConfig struct {
	Mode             *string `toml:"mode"`
	IgnoreWhitespace *bool   `toml:"ignore_whitespace"`
}

DiffFileConfig holds diff-related config file settings.

type FileConfig added in v0.3.0

type FileConfig struct {
	Diff     DiffFileConfig     `toml:"diff"`
	Watch    WatchFileConfig    `toml:"watch"`
	Commit   CommitFileConfig   `toml:"commit"`
	FileList FileListFileConfig `toml:"filelist"`
}

FileConfig represents the structure of a TOML config file. Pointer fields distinguish "not set" from zero-value, allowing higher-precedence layers to override lower-precedence values (including resetting to defaults).

func LoadFileConfig added in v0.3.0

func LoadFileConfig(path string) (FileConfig, error)

LoadFileConfig reads and parses a TOML config file. Returns a zero-value FileConfig if the file does not exist.

func MergeFileConfigs added in v0.3.0

func MergeFileConfigs(user, repo FileConfig) FileConfig

MergeFileConfigs merges user and repo configs. Repo values override user values when explicitly set (non-nil pointer). Returns the merged result.

type FileListFileConfig added in v0.3.0

type FileListFileConfig struct {
	GroupByDirectory *bool `toml:"group_by_directory"`
}

FileListFileConfig holds file list display settings.

type ParseOption added in v0.3.0

type ParseOption func(*parseOpts)

ParseOption configures Parse behavior.

func WithConfigPaths added in v0.3.0

func WithConfigPaths(userPath, repoPath string) ParseOption

WithConfigPaths overrides the default config file paths (for testing).

type WatchFileConfig added in v0.3.0

type WatchFileConfig struct {
	Interval *string `toml:"interval"`
}

WatchFileConfig holds watch-related config file settings.

Jump to

Keyboard shortcuts

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