config

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	ProgName      string
	CommitTypes   []CommitTypeOption  `json:"commit-types"   mapstructure:"commit-types"`
	CommitMessage CommitMessageConfig `json:"commit-message" mapstructure:"commit-message"`
	Branch        BranchConfig        `json:"branch"         mapstructure:"branch"`
	IssueTracker  IssueTrackerConfig  `json:"issue-tracker"  mapstructure:"issue-tracker"`
}

AppConfig is the top-level configuration for the application.

func Load

func Load() (*AppConfig, error)

Load parses the embedded default.json then overlays any values present in the global viper instance. Each config section is handled individually so that a partial override (e.g. only commit-message.items) preserves unset defaults. viper.Sub is avoided because it silently returns nil for array-typed keys.

type BranchConfig

type BranchConfig struct {
	Base string `json:"base" mapstructure:"base"`
}

BranchConfig holds branch-related settings. Base is the branch new branches are cut from; empty means auto-detect.

type CommitItem

type CommitItem struct {
	Name     string             `json:"name"     mapstructure:"name"`
	Desc     string             `json:"desc"     mapstructure:"desc"`
	Form     string             `json:"form"     mapstructure:"form"`
	Required bool               `json:"required" mapstructure:"required"`
	Options  []CommitItemOption `json:"options"  mapstructure:"options"`
	Value    string             `json:"-" mapstructure:"-"` // runtime state; never serialised
}

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" mapstructure:"name"`
	Desc string `json:"desc" mapstructure:"desc"`
}

CommitItemOption is a selectable option within a CommitItem select field.

type CommitMessageConfig

type CommitMessageConfig struct {
	Items    []CommitItem `json:"items"    mapstructure:"items"`
	Template string       `json:"template" mapstructure:"template"`
}

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" mapstructure:"name"`
	Desc string `json:"desc" mapstructure:"desc"`
}

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

type IssueTrackerConfig

type IssueTrackerConfig struct {
	Type  string `json:"type"  mapstructure:"type"`
	URL   string `json:"url"   mapstructure:"url"`
	Token string `json:"token" mapstructure:"token"`
}

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

Jump to

Keyboard shortcuts

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