config

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads nt's optional config file, $NT_DIR/config.toml. It is a deliberately tiny TOML subset — [section] headers and `key = value` lines with string / int / bool values — so nt keeps its zero-runtime-dependency, plain- text ethos (no TOML library). A missing or partial file is never an error; unset keys keep their zero value and callers fall back to built-in defaults.

Recognized keys (all optional):

[defaults]
priority    = "high"        # default --pri for `nt add`
source      = "cli"         # default --source
agenda_days = 7             # default horizon for `nt agenda`
editor      = "nvim"        # overrides $EDITOR for `nt edit`

[web]
port = 4321                 # default `nt web` port
host = "127.0.0.1"          # default bind address

[tui]
theme = "auto"              # auto | light | dark

Index

Constants

View Source
const FileName = "config.toml"

FileName is the config file's basename within $NT_DIR.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultPriority string // [defaults] priority
	DefaultSource   string // [defaults] source
	AgendaDays      int    // [defaults] agenda_days
	Editor          string // [defaults] editor
	WebPort         int    // [web] port
	WebHost         string // [web] host
	WebDayBudget    int    // [web] day_budget_minutes — Today capacity bar budget (0 = default 360)
	TUITheme        string // [tui] theme (auto|light|dark)
}

Config is the parsed config. Zero values mean "unset" — callers OR them with their existing defaults.

func Load

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

Load reads $NT_DIR/config.toml. A missing file returns an empty Config and no error. Parse errors in individual lines are skipped, not fatal — a typo in one key never stops nt from running.

Jump to

Keyboard shortcuts

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