config

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config loads application and repository configuration from YAML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomThemesToThemeDataMap added in v1.25.0

func CustomThemesToThemeDataMap(customThemes map[string]*CustomTheme) map[string]*theme.CustomThemeData

CustomThemesToThemeDataMap converts a map of CustomTheme to theme.CustomThemeData.

func DefaultDeltaArgsForTheme added in v1.8.0

func DefaultDeltaArgsForTheme(themeName string) []string

DefaultDeltaArgsForTheme returns the default delta arguments for a given theme.

func NormalizeThemeName added in v1.8.0

func NormalizeThemeName(name string) string

NormalizeThemeName returns the normalized theme name if valid, otherwise empty string.

func SaveConfig added in v1.22.0

func SaveConfig(cfg *AppConfig) error

SaveConfig writes the configuration back to the file. It tries to preserve existing fields by reading the file first.

func SyntaxThemeForUITheme added in v1.6.0

func SyntaxThemeForUITheme(themeName string) string

SyntaxThemeForUITheme returns the syntax theme name for a given TUI theme.

Types

type AppConfig

type AppConfig struct {
	WorktreeDir             string
	InitCommands            []string
	TerminateCommands       []string
	SortMode                string // Sort mode: "path", "active" (commit date), "switched" (last accessed)
	AutoFetchPRs            bool
	DisablePR               bool // Disable all PR/MR fetching and display
	SearchAutoSelect        bool // Start with filter focused and select first match on Enter.
	MaxUntrackedDiffs       int
	MaxDiffChars            int
	MaxNameLength           int // Maximum length for worktree names in table display (0 disables truncation)
	GitPagerArgs            []string
	GitPagerArgsSet         bool `yaml:"-"`
	GitPager                string
	GitPagerInteractive     bool // Interactive tools need terminal control, skip piping to less
	GitPagerCommandMode     bool // Command-mode tools run their own git commands (e.g. lumen diff)
	TrustMode               string
	DebugLog                string
	Pager                   string
	CIScriptPager           string // Pager for CI check logs, implicitly interactive
	Editor                  string
	AutoRefresh             bool
	CIAutoRefresh           bool // Periodically refresh CI status (GitHub only, uses API rate limits)
	RefreshIntervalSeconds  int
	CustomCommands          map[string]*CustomCommand
	BranchNameScript        string // Script to generate branch name suggestions from diff
	Theme                   string // Theme name: see AvailableThemes in internal/theme
	MergeMethod             string // Merge method for absorb: "rebase" or "merge" (default: "rebase")
	FuzzyFinderInput        bool   // Enable fuzzy finder for input suggestions (default: false)
	IconSet                 string // Icon set: "nerd-font-v3", "text" (default: "nerd-font-v3"). Legacy "emoji" and "none" map to "text".
	IssueBranchNameTemplate string // Template for issue branch names with placeholders: {number}, {title} (default: "issue-{number}-{title}")
	SessionPrefix           string // Prefix for tmux/zellij session names (default: "wt-")
	PaletteMRU              bool   // Enable MRU sorting for command palette (default: false)
	PaletteMRULimit         int    // Number of MRU items to show (default: 5)
	CustomCreateMenus       []*CustomCreateMenu
	CustomThemes            map[string]*CustomTheme // User-defined custom themes
	ConfigPath              string                  `yaml:"-"` // Path to the configuration file
}

AppConfig defines the global lazyworktree configuration options.

func DefaultConfig

func DefaultConfig() *AppConfig

DefaultConfig returns the default configuration values.

func LoadConfig

func LoadConfig(configPath string) (*AppConfig, error)

LoadConfig loads the application configuration from a file.

func (*AppConfig) ApplyCLIOverrides added in v1.24.0

func (cfg *AppConfig) ApplyCLIOverrides(overrides []string) error

ApplyCLIOverrides applies CLI config overrides to the configuration.

func (*AppConfig) IconsEnabled added in v1.27.0

func (c *AppConfig) IconsEnabled() bool

IconsEnabled reports whether icon rendering should be enabled for the current icon set.

type CustomCommand added in v1.1.0

type CustomCommand struct {
	Command     string
	Description string
	ShowHelp    bool
	Wait        bool
	ShowOutput  bool
	NewTab      bool // Launch command in a new terminal tab (Kitty, etc.)
	Tmux        *TmuxCommand
	Zellij      *TmuxCommand
}

CustomCommand represents a user-defined command binding.

type CustomCreateMenu added in v1.21.0

type CustomCreateMenu struct {
	Label           string // Display label in the menu
	Description     string // Help text shown next to label
	Command         string // Shell command that outputs branch name
	Interactive     bool   // Run interactively (TUI suspends, captures stdout via temp file)
	PostCommand     string // Command to run after worktree creation (optional)
	PostInteractive bool   // Run post-command interactively (default: false)
}

CustomCreateMenu defines a custom entry in the worktree creation menu. The command should output a branch name that will be sanitized and used.

type CustomTheme added in v1.25.0

type CustomTheme struct {
	Base      string // Optional base theme name (built-in or custom)
	Accent    string
	AccentFg  string
	AccentDim string
	Border    string
	BorderDim string
	MutedFg   string
	TextFg    string
	SuccessFg string
	WarnFg    string
	ErrorFg   string
	Cyan      string
}

CustomTheme represents a user-defined theme that can inherit from built-in or other custom themes.

func (*CustomTheme) ToThemeData added in v1.25.0

func (ct *CustomTheme) ToThemeData() *theme.CustomThemeData

ToThemeData converts CustomTheme to theme.CustomThemeData to avoid circular dependencies.

type RepoConfig

type RepoConfig struct {
	InitCommands      []string
	TerminateCommands []string
	Path              string
}

RepoConfig represents repository-scoped commands from .wt

func LoadRepoConfig

func LoadRepoConfig(repoPath string) (*RepoConfig, string, error)

LoadRepoConfig loads the repository configuration from a .wt file.

type TmuxCommand added in v1.7.0

type TmuxCommand struct {
	SessionName string
	Attach      bool
	OnExists    string
	Windows     []TmuxWindow
}

TmuxCommand represents a configured tmux session layout.

type TmuxWindow added in v1.7.0

type TmuxWindow struct {
	Name    string
	Command string
	Cwd     string
}

TmuxWindow represents a tmux window configuration.

Jump to

Keyboard shortcuts

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