config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config loads Critty configuration from the XDG config directory (global) and the project root (.critty.toml), mirroring crit's two-level merge semantics for the subset of keys Critty supports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalPath

func GlobalPath() string

GlobalPath returns the global config file path.

func ProjectPath

func ProjectPath(root string) string

ProjectPath returns the project config file path under root.

Types

type Config

type Config struct {
	History          history.Policy    `json:"history"`
	Output           string            `json:"output,omitempty"`
	Author           string            `json:"author,omitempty"`
	Split            bool              `json:"split,omitempty"`
	IgnorePatterns   []string          `json:"ignore_patterns,omitempty"`
	Launchers        []string          `json:"launchers,omitempty"`
	TextconvDrivers  []string          `json:"textconv_drivers,omitempty"`
	Quiet            bool              `json:"quiet,omitempty"`
	CleanupOnApprove bool              `json:"cleanup_on_approve,omitempty"`
	DisableStats     bool              `json:"disable_stats,omitempty"`
	Prompts          map[string]string `json:"prompts,omitempty"`

	// ProjectRoot is the directory the project-level config was resolved
	// against (git top level or cwd).  Not part of the file format.
	ProjectRoot string `json:"-"`
}

Config is the resolved (merged) configuration.

func Load

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

Load merges global and project configuration. projectRoot may be empty to skip the project level. Missing files are not errors.

func LoadCurrent

func LoadCurrent() (*Config, error)

LoadCurrent loads configuration for the current directory, using the git top-level directory as the project root when inside a repository.

Jump to

Keyboard shortcuts

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