config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package config provides configuration loading from TOML files and CLI flags.

Index

Constants

View Source
const (
	CostAuto = "auto"
	CostOn   = "true"
	CostOff  = "false"
)

Cost mode values.

Variables

This section is empty.

Functions

func NormalizeCostMode added in v1.0.0

func NormalizeCostMode(raw string) string

NormalizeCostMode converts various user inputs to a canonical cost mode. Accepts: "auto", "true"/"1"/"on", "false"/"0"/"off". Returns "" for unknown values.

func Validate added in v1.0.0

func Validate(configPath string) []string

Validate checks the config file at the given path for errors. Returns a list of human-readable problems. Empty list means valid.

Types

type Cache

type Cache struct {
	UsageTTL  time.Duration `mapstructure:"usage_ttl"`
	StatusTTL time.Duration `mapstructure:"status_ttl"`
}

Cache controls cache TTL durations.

type Config

type Config struct {
	Segments    Segments `mapstructure:"segments"`
	Cache       Cache    `mapstructure:"cache"`
	MacInsecure bool     `mapstructure:"mac_insecure"`
}

Config holds all claudeline configuration.

func Defaults

func Defaults() Config

Defaults returns a Config with all segments enabled and default TTLs.

func Load

func Load(configPath string) Config

Load reads configuration from a TOML file at the given path. Missing file or parse errors result in defaults being used.

type Segments

type Segments struct {
	Model         bool   `mapstructure:"model"`
	Effort        bool   `mapstructure:"effort"`
	Thinking      bool   `mapstructure:"thinking"`
	FastMode      bool   `mapstructure:"fast_mode"`
	Worktree      bool   `mapstructure:"worktree"`
	Cost          string `mapstructure:"cost"`
	Status        bool   `mapstructure:"status"`
	Context       bool   `mapstructure:"context"`
	Compactions   bool   `mapstructure:"compactions"`
	Quota         bool   `mapstructure:"quota"`
	PerModelQuota bool   `mapstructure:"per_model_quota"`
	Credits       bool   `mapstructure:"credits"`
	OffPeak       bool   `mapstructure:"offpeak"`
}

Segments controls which statusline segments are displayed.

Jump to

Keyboard shortcuts

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