Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubCommandName = "zf"
	ProgName       = "git-" + SubCommandName
)

Variables

This section is empty.

Functions

func DefaultTOML added in v0.7.0

func DefaultTOML() []byte

DefaultTOML returns the raw embedded default configuration bytes.

func HomePath added in v0.5.0

func HomePath() (string, error)

HomePath returns the configuration file path in the user home directory.

func RepoPath added in v0.5.0

func RepoPath() string

RepoPath returns the configuration file path in the repository's git directory (gitfiles, submodules and linked worktrees resolved via git rev-parse), or "" when not inside a git repository.

Types

type AppConfig

type AppConfig struct {
	ProgName      string              `json:"-" toml:"-"`
	ConfigFile    string              `json:"-" toml:"-"` // path the values were loaded from; "" when none
	CommitTypes   []CommitTypeOption  `json:"commit-types"   toml:"commit-types"`
	CommitMessage CommitMessageConfig `json:"commit-message" toml:"commit-message"`
	Branch        BranchConfig        `json:"branch"         toml:"branch"`
	Push          PushConfig          `json:"push"           toml:"push"`
	IssueTracker  IssueTrackerConfig  `json:"issue-tracker"  toml:"issue-tracker"`
}

AppConfig is the top-level configuration for the application.

func Load

func Load(paths ...string) (*AppConfig, error)

Load parses the embedded default.toml, then overlays each existing file in paths in order (later files win). A file that does not exist is skipped. Each unmarshal merges into the same struct, so a key a file leaves out keeps its earlier value while a slice a file does set replaces the earlier one wholesale. ConfigFile records the last file that was actually read.

type BranchConfig

type BranchConfig struct {
	Base        string `json:"base"          toml:"base"`
	Remote      string `json:"remote"        toml:"remote"`
	UseWorktree *bool  `json:"use-worktree"  toml:"use-worktree"`
	WorktreeDir string `json:"worktree-dir"  toml:"worktree-dir"`
}

BranchConfig holds branch-related settings. Base is the branch new branches are cut from; empty means auto-detect. Remote is the git remote name to use; empty means auto-detect.

type CommitItem

type CommitItem struct {
	Name     string             `json:"name"     toml:"name"`
	Desc     string             `json:"desc"     toml:"desc"`
	Form     string             `json:"form"     toml:"form"`
	Required bool               `json:"required" toml:"required"`
	Options  []CommitItemOption `json:"options"  toml:"options"`
	Value    string             `json:"-"        toml:"-"`
}

CommitItem describes one field in the commit message form. Value is written by the form after the user submits.

type CommitItemOption

type CommitItemOption struct {
	Name string `json:"name" toml:"name"`
	Desc string `json:"desc" toml:"desc"`
}

CommitItemOption is a selectable option within a CommitItem select field.

type CommitMessageConfig

type CommitMessageConfig struct {
	Items       []CommitItem `json:"items"        toml:"items"`
	Template    string       `json:"template"     toml:"template"`
	RefFormat   string       `json:"ref-format"   toml:"ref-format"`
	CloseFormat string       `json:"close-format" toml:"close-format"`
}

CommitMessageConfig holds the ordered list of form fields and the Go template used to assemble the commit message.

type CommitTypeOption

type CommitTypeOption struct {
	Name string `json:"name" toml:"name"`
	Desc string `json:"desc" toml:"desc"`
}

CommitTypeOption is a single commit type entry (e.g. "feat", "fix").

type IssueTrackerConfig

type IssueTrackerConfig struct {
	Type     string   `json:"type"     toml:"type"`
	URL      string   `json:"url"      toml:"url"`
	Token    string   `json:"token"    toml:"token"`
	Projects []string `json:"projects" toml:"projects"`
}

IssueTrackerConfig holds connection parameters for one tracker instance. Never log values of this type — Token is a secret.

type PushConfig added in v0.12.0

type PushConfig struct {
	Propose bool `json:"propose" toml:"propose"`
}

PushConfig holds settings for the post-action push proposal. Propose is the master switch (default true); when false the propose-to-push step is skipped everywhere.

Jump to

Keyboard shortcuts

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