config

package
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultKeyMaxLen = 64

DefaultKeyMaxLen is the default maximum length for keys

View Source
const DefaultKeyPattern = `^[a-z0-9]+(-[a-z0-9]+)*$`

DefaultKeyPattern is the default regex pattern for keys

Variables

This section is empty.

Functions

func LastSegment added in v2.3.0

func LastSegment(key string) string

LastSegment returns the last segment of a key (after the last `/`). For flat keys (no `/`), returns the key itself.

func ValidateKey added in v2.3.0

func ValidateKey(key string, pattern *regexp.Regexp, maxLen int) error

ValidateKey validates a key that may contain path segments separated by "/". Each segment must match the pattern, and the total length must not exceed maxLen.

Types

type Config

type Config struct {
	Version   int
	Types     map[model.TypeName]TypeDef
	Tags      TagConfig
	Edges     map[model.EdgeType]EdgeDef
	Templates TemplateConfig
	Editor    string // Editor command to use for opening files
}

Config represents the complete touchlog configuration

func LoadConfig

func LoadConfig(vaultRoot string) (*Config, error)

LoadConfig loads and merges configuration from built-in, global, and repo sources Merge precedence: built-in < global < repo

type EdgeDef

type EdgeDef struct {
	Description string
	AllowedFrom []model.TypeName
	AllowedTo   []model.TypeName
}

EdgeDef defines an edge type

type TagConfig

type TagConfig struct {
	Preferred []string
}

TagConfig defines tag-related configuration

type TemplateConfig

type TemplateConfig struct {
	Root string
}

TemplateConfig defines template configuration

type TypeDef

type TypeDef struct {
	Description       string
	DefaultState      string
	RequiredFields    []string // dot paths
	RecommendedFields []string
	KeyPattern        *regexp.Regexp
	KeyMaxLen         int
}

TypeDef defines a note type

Jump to

Keyboard shortcuts

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