config

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config reads and writes ~/.config/claude-usage/config.toml.

Missing config file is not an error — defaults are returned. Writes create the directory if needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns ~/.config/claude-usage/config.toml (honouring XDG_CONFIG_HOME).

func Save

func Save(c Config) error

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

Types

type Config

type Config struct {
	PollIntervalSeconds int    `toml:"poll_interval_seconds"`
	WarnThreshold       int    `toml:"warn_threshold"`
	AlertThreshold      int    `toml:"alert_threshold"`
	Notify              bool   `toml:"notify"`
	OrgID               string `toml:"org_id"`

	// LastSeenVersion is the version string the user has already
	// been welcomed for. When the running binary's version differs
	// (fresh install, upgrade) the CLI prints a one-shot welcome
	// banner and persists the new value.
	LastSeenVersion string `toml:"last_seen_version,omitempty"`
}

Config holds user-tunable knobs.

func Default

func Default() Config

Default returns the baseline config.

Thresholds use a battery-style palette: green below WarnThreshold, orange between, red at or above AlertThreshold. Defaults are tuned to give a margin of about 35% to warn and 10% to act.

func Load

func Load() (Config, error)

Load returns the config from disk, falling back to Default() if the file doesn't exist. Returns an error for malformed TOML.

Jump to

Keyboard shortcuts

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