config

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 9 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 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
	SearchAutoSelect        bool // Start with filter focused and select first match on Enter.
	MaxUntrackedDiffs       int
	MaxDiffChars            int
	GitPagerArgs            []string
	GitPagerArgsSet         bool `yaml:"-"`
	GitPager                string
	GitPagerInteractive     bool // Interactive tools need terminal control, skip piping to less
	TrustMode               string
	DebugLog                string
	Pager                   string
	Editor                  string
	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)
	ShowIcons               bool   // Render Nerd Font icons in file trees and PR views (default: true)
	IssueBranchNameTemplate string // Template for issue branch names with placeholders: {number}, {title} (default: "issue-{number}-{title}")
	PRBranchNameTemplate    string // Template for PR branch names with placeholders: {number}, {title} (default: "pr-{number}-{title}")
	CustomCreateMenus       []*CustomCreateMenu
	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.

type CustomCommand added in v1.1.0

type CustomCommand struct {
	Command     string
	Description string
	ShowHelp    bool
	Wait        bool
	ShowOutput  bool
	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 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