config

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultWorktreeBase = "~/github/worktree"
	ConfigName          = "config"
	ConfigType          = "yaml"
)

Default values.

Variables

This section is empty.

Functions

func ConfigFileUsed

func ConfigFileUsed() string

ConfigFileUsed returns the path of the loaded config file (or "" if none).

func Load

func Load() (*viper.Viper, error)

Load initializes Viper and reads the configuration. It returns the loaded Viper instance and handles file-not-found gracefully. If no config file exists, it creates one with default values.

func Save

func Save() error

Save persists the current Viper state to the config file. Creates directories and file if needed.

func Set

func Set(key string, value any)

Set updates a value in the Viper store (in memory only). Call Save() afterward to persist changes.

Types

type Action

type Action struct {
	Name string   `mapstructure:"name"`
	Cmds []string `mapstructure:"cmds"`
	Dir  string   `mapstructure:"dir"`
}

Action defines a named set of commands to run.

type Config

type Config struct {
	WorktreeBase string   `mapstructure:"worktree_dir"`
	Actions      []Action `mapstructure:"actions"`
}

Config holds the application configuration.

func Get

func Get() (Config, error)

Get returns the unmarshaled configuration struct. Prefer this over direct viper.Get* calls for type safety.

Jump to

Keyboard shortcuts

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