config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles loading user configuration from disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save added in v1.3.0

func Save(cfg Config) error

Save writes the config back to the OS config directory.

Types

type Config

type Config struct {
	DarkTheme  string `json:"dark_theme"`          // cyber | matrix | dracula | nord
	LightTheme string `json:"light_theme"`         // clean | solarized
	Telemetry  *bool  `json:"telemetry,omitempty"` // nil = enabled (opt-out default), false = disabled
	ClientID   string `json:"client_id,omitempty"` // random UUID for anonymous telemetry identity
}

Config holds persistent user preferences for unum.

func EnsureClientID added in v1.3.0

func EnsureClientID() Config

EnsureClientID loads the config, generates a client ID if missing, saves, and returns the config. If saving fails, the in-memory config is still returned with the generated ID.

func Load

func Load() Config

Load reads the config file from the OS config directory. Returns defaults if the file is absent or malformed. Location: $XDG_CONFIG_HOME/unum/config.json (Linux/macOS)

%APPDATA%\unum\config.json             (Windows)

func (Config) TelemetryEnabled added in v1.3.0

func (c Config) TelemetryEnabled() bool

TelemetryEnabled reports whether telemetry should be active. Priority: DO_NOT_TRACK=1 > UNUM_NO_TELEMETRY=1 > config file > default (true).

Jump to

Keyboard shortcuts

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