config

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides persistent application configuration for PuzzleTea. Settings are stored as JSON in ~/.puzzletea/config.json alongside the game history database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDBPath added in v1.7.0

func DefaultDBPath() string

DefaultDBPath returns the default database path ~/.puzzletea/history.db.

func DefaultPath

func DefaultPath() string

DefaultPath returns ~/.puzzletea/config.json.

Types

type Config

type Config struct {
	Theme  string `json:"theme,omitempty"`   // theme name; empty = default
	DBPath string `json:"db_path,omitempty"` // database path; empty = ~/.puzzletea/history.db
}

Config holds all user-configurable settings.

func Default

func Default() *Config

Default returns a Config with all settings at their zero values (the built-in defaults).

func Load

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

Load reads and parses a config file. If the file does not exist, a default Config is returned with no error. Parse errors are returned so callers can log a warning, but the application should still start with defaults.

func (*Config) Save

func (c *Config) Save(path string) error

Save writes the config to disk, creating the parent directory if needed.

Jump to

Keyboard shortcuts

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