config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(v bool) *bool

func GlobalConfigPath

func GlobalConfigPath() string

func IsWillowRepo added in v0.1.2

func IsWillowRepo(bareDir string) bool

IsWillowRepo checks if bareDir lives under ~/.willow/repos/. Both paths are resolved through EvalSymlinks to handle macOS /var → /private/var.

func ListRepos added in v0.1.2

func ListRepos() ([]string, error)

ListRepos scans ~/.willow/repos/ for *.git dirs and returns repo names (without .git suffix).

func LocalConfigPath

func LocalConfigPath(bareDir string) string

func ReposDir

func ReposDir() string

func ResolveRepo added in v0.1.2

func ResolveRepo(name string) (string, error)

ResolveRepo returns the bare dir path for a named repo under ~/.willow/repos/.

func ResolveRepoFromDir added in v0.2.0

func ResolveRepoFromDir(dir string) (string, bool)

ResolveRepoFromDir checks if dir is at or under ~/.willow/worktrees/<name>/ and returns the corresponding bare repo path (~/.willow/repos/<name>.git). This allows commands to work from the worktrees/<name>/ directory itself, not just from inside a specific worktree.

func Save

func Save(cfg *Config, path string) error

Save writes a config to the given path, creating directories as needed.

func SharedConfigPath

func SharedConfigPath(worktreeRoot string) string

func WillowHome

func WillowHome() string

WillowHome returns ~/.willow

func WorktreesDir

func WorktreesDir() string

Types

type Config

type Config struct {
	BaseBranch       string   `json:"baseBranch,omitempty"`
	BranchPrefix     string   `json:"branchPrefix,omitempty"`
	PostCheckoutHook string   `json:"postCheckoutHook,omitempty"`
	Setup            []string `json:"setup,omitempty"`
	Teardown         []string `json:"teardown,omitempty"`
	Defaults         Defaults `json:"defaults"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load(bareDir, worktreeRoot string) *Config

Load resolves config by merging 3 tiers: global → shared → local. bareDir and worktreeRoot can be empty if unavailable (e.g. not in a repo).

func LoadFile

func LoadFile(path string) (*Config, error)

type Defaults

type Defaults struct {
	Fetch           *bool `json:"fetch,omitempty"`
	AutoSetupRemote *bool `json:"autoSetupRemote,omitempty"`
}

Jump to

Keyboard shortcuts

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