config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKeyBinding

func BuildKeyBinding(keys []string, help string, description string) key.Binding

BuildKeyBinding creates a key.Binding from config

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the path to the config file

Types

type ColorsConfig

type ColorsConfig struct {
	Todo      string `toml:"todo"`
	Progress  string `toml:"progress"`
	Blocked   string `toml:"blocked"`
	Done      string `toml:"done"`
	Cursor    string `toml:"cursor"`
	Title     string `toml:"title"`
	Scheduled string `toml:"scheduled"`
	Overdue   string `toml:"overdue"`
	Status    string `toml:"status"`
	Note      string `toml:"note"`
	Folded    string `toml:"folded"`
}

ColorsConfig holds color configurations

type Config

type Config struct {
	Keybindings KeybindingsConfig `toml:"keybindings"`
	Colors      ColorsConfig      `toml:"colors"`
	Tags        TagsConfig        `toml:"tags"`
	States      StatesConfig      `toml:"states"`
	UI          UIConfig          `toml:"ui"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from the config file

func (*Config) AddState

func (c *Config) AddState(name, color string)

AddState adds a new state to the configuration

func (*Config) AddTag

func (c *Config) AddTag(name, color string)

AddTag adds a new tag to the configuration

func (*Config) GetAllKeybindings

func (c *Config) GetAllKeybindings() map[string][]string

GetAllKeybindings returns a map of all keybindings

func (*Config) GetDefaultNewTaskState

func (c *Config) GetDefaultNewTaskState() string

GetDefaultNewTaskState returns the default state for new tasks Returns empty string if configured as "none" or if the configured state doesn't exist

func (*Config) GetStateColor

func (c *Config) GetStateColor(stateName string) string

GetStateColor returns the color for a given state name

func (*Config) GetStateNames

func (c *Config) GetStateNames() []string

GetStateNames returns all configured state names

func (*Config) GetTagColor

func (c *Config) GetTagColor(tagName string) string

GetTagColor returns the color for a given tag name

func (*Config) RemoveState

func (c *Config) RemoveState(name string)

RemoveState removes a state from the configuration

func (*Config) RemoveTag

func (c *Config) RemoveTag(name string)

RemoveTag removes a tag from the configuration

func (*Config) Save

func (c *Config) Save() error

Save saves the configuration to the config file

func (*Config) UpdateKeybinding

func (c *Config) UpdateKeybinding(action string, keys []string) error

UpdateKeybinding updates a keybinding in the configuration

func (*Config) UpdateStateColor

func (c *Config) UpdateStateColor(name, color string)

UpdateStateColor updates the color of an existing state

func (*Config) UpdateTagColor

func (c *Config) UpdateTagColor(name, color string)

UpdateTagColor updates the color of an existing tag

type KeybindingsConfig

type KeybindingsConfig struct {
	Up            []string `toml:"up"`
	Down          []string `toml:"down"`
	Left          []string `toml:"left"`
	Right         []string `toml:"right"`
	ShiftUp       []string `toml:"shift_up"`
	ShiftDown     []string `toml:"shift_down"`
	ShiftLeft     []string `toml:"shift_left"`
	ShiftRight    []string `toml:"shift_right"`
	Rename        []string `toml:"rename"`
	CycleState    []string `toml:"cycle_state"`
	ToggleFold    []string `toml:"toggle_fold"`
	ToggleFoldAll []string `toml:"toggle_fold_all"`
	EditNotes     []string `toml:"edit_notes"`
	ToggleView    []string `toml:"toggle_view"`
	Capture       []string `toml:"capture"`
	AddSubTask    []string `toml:"add_subtask"`
	Delete        []string `toml:"delete"`
	Save          []string `toml:"save"`
	ToggleReorder []string `toml:"toggle_reorder"`
	ClockIn       []string `toml:"clock_in"`
	ClockOut      []string `toml:"clock_out"`
	SetDeadline   []string `toml:"set_deadline"`
	SetScheduled  []string `toml:"set_scheduled"`
	SetPriority   []string `toml:"set_priority"`
	SetEffort     []string `toml:"set_effort"`
	Help          []string `toml:"help"`
	Quit          []string `toml:"quit"`
	Settings      []string `toml:"settings"`
	TagItem       []string `toml:"tag_item"`
}

KeybindingsConfig holds all keybinding configurations

type StateConfig

type StateConfig struct {
	Name  string `toml:"name"`
	Color string `toml:"color"`
}

StateConfig represents a single TODO state configuration

type StatesConfig

type StatesConfig struct {
	States              []StateConfig `toml:"states"`
	DefaultNewTaskState string        `toml:"default_new_task_state"`
}

StatesConfig holds TODO state configurations

type TagConfig

type TagConfig struct {
	Name  string `toml:"name"`
	Color string `toml:"color"`
}

TagConfig represents a single tag configuration

type TagsConfig

type TagsConfig struct {
	Enabled    bool        `toml:"enabled"`
	Tags       []TagConfig `toml:"tags"`
	DefaultTag string      `toml:"default_tag"`
}

TagsConfig holds tag configurations

type UIConfig

type UIConfig struct {
	HelpTextWidth         int    `toml:"help_text_width"`
	MinTerminalWidth      int    `toml:"min_terminal_width"`
	AgendaDays            int    `toml:"agenda_days"`
	OrgSyntaxHighlighting bool   `toml:"org_syntax_highlighting"`
	ShowIndentationGuides bool   `toml:"show_indentation_guides"`
	IndentationGuideColor string `toml:"indentation_guide_color"`
}

UIConfig holds UI-related configurations

Jump to

Keyboard shortcuts

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