config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName  = ".wtp.yml"
	CurrentVersion  = "1.0"
	DefaultBaseDir  = "../worktrees"
	HookTypeCopy    = "copy"
	HookTypeCommand = "command"
)

Variables

This section is empty.

Functions

func SaveConfig

func SaveConfig(repoRoot string, config *Config) error

SaveConfig saves configuration to .git-worktree-plus.yml in the repository root

Types

type Config

type Config struct {
	Version  string   `yaml:"version"`
	Defaults Defaults `yaml:"defaults,omitempty"`
	Hooks    Hooks    `yaml:"hooks,omitempty"`
}

Config represents the wtp configuration

func LoadConfig

func LoadConfig(repoRoot string) (*Config, error)

LoadConfig loads configuration from .wtp.yml in the repository root

func (*Config) HasHooks

func (c *Config) HasHooks() bool

HasHooks returns true if the configuration has any post-create hooks

func (*Config) ResolveWorktreePath

func (c *Config) ResolveWorktreePath(repoRoot, worktreeName string) string

ResolveWorktreePath resolves the full path for a worktree given a name

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type Defaults

type Defaults struct {
	BaseDir string `yaml:"base_dir,omitempty"`
}

Defaults represents default configuration values

type Hook

type Hook struct {
	Type    string            `yaml:"type"` // "copy" or "command"
	From    string            `yaml:"from,omitempty"`
	To      string            `yaml:"to,omitempty"`
	Command string            `yaml:"command,omitempty"`
	Env     map[string]string `yaml:"env,omitempty"`
	WorkDir string            `yaml:"work_dir,omitempty"`
}

Hook represents a single hook configuration

func (*Hook) Validate

func (h *Hook) Validate() error

Validate validates a single hook configuration

type Hooks

type Hooks struct {
	PostCreate []Hook `yaml:"post_create,omitempty"`
}

Hooks represents the post-create hooks configuration

Jump to

Keyboard shortcuts

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