Documentation
¶
Index ¶
Constants ¶
const DefaultWorktreeFormat = "{repo}-{branch}"
DefaultWorktreeFormat is the default format for worktree folder names
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init creates a default config file at ~/.config/wt/config.toml If force is true, overwrites existing file Returns the path to the created file
func ValidatePath ¶
ValidatePath checks that the path is absolute or starts with ~ Returns error if path is relative (like "." or "..")
Types ¶
type CloneConfig ¶
type CloneConfig struct {
Forge string `toml:"forge"` // default forge: "github" or "gitlab"
Org string `toml:"org"` // default organization when not specified
Rules []CloneRule `toml:"rules"` // pattern-based rules
}
CloneConfig holds clone-related configuration
func (*CloneConfig) GetForgeForRepo ¶
func (c *CloneConfig) GetForgeForRepo(repoSpec string) string
GetForgeForRepo returns the forge name for a given repo spec (e.g., "org/repo") Matches against clone rules in order, returns default if no match
type CloneRule ¶
type CloneRule struct {
Pattern string `toml:"pattern"` // glob pattern like "n26/*" or "company/*"
Forge string `toml:"forge"` // "github" or "gitlab"
}
CloneRule maps a pattern to a forge
type Config ¶
type Config struct {
WorktreeDir string `toml:"worktree_dir"`
RepoDir string `toml:"repo_dir"` // optional: where to find repos for -r/-l
WorktreeFormat string `toml:"worktree_format"`
BaseRef string `toml:"base_ref"` // "local" or "remote" (default: "remote")
DefaultSort string `toml:"default_sort"` // "id", "repo", "branch", "commit" (default: "id")
Hooks HooksConfig `toml:"-"` // custom parsing needed
Clone CloneConfig `toml:"clone"`
Merge MergeConfig `toml:"merge"`
Hosts map[string]string `toml:"hosts"` // domain -> forge type mapping
}
Config holds the wt configuration
func Load ¶
Load reads config from ~/.config/wt/config.toml Returns Default() if file doesn't exist (no error) Returns error only if file exists but is invalid
func (*Config) RepoScanDir ¶
RepoScanDir returns the directory to scan for repositories. Returns RepoDir if set, otherwise falls back to WorktreeDir.
type Hook ¶
type Hook struct {
Command string `toml:"command"`
Description string `toml:"description"`
On []string `toml:"on"` // commands this hook runs on (empty = only via --hook)
}
Hook defines a post-create hook
type HooksConfig ¶
HooksConfig holds hook-related configuration
type MergeConfig ¶
type MergeConfig struct {
Strategy string `toml:"strategy"` // "squash", "rebase", or "merge"
}
MergeConfig holds merge-related configuration