Documentation
¶
Overview ¶
Package config loads and defaults a repo's .draftsman.yml.
Index ¶
Constants ¶
const ( ModeSingle = "single" ModeMulti = "multi" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct {
Type string `yaml:"type"`
Scope string `yaml:"scope"`
Section string `yaml:"section"`
}
Category maps a Conventional Commit type — optionally narrowed to a specific scope — to a changelog section name. A commit is matched against the configured Categories in order, first match wins; Scope empty matches any scope for that Type. This lets a scope-specific rule (e.g. type "fix", scope "security") take a commit before a broader type-only rule for the same Type, as long as it's listed first. Order in the config also determines section display order.
type Config ¶
type Config struct {
Mode string `yaml:"mode"`
Categories []Category `yaml:"categories"`
Packages []Package `yaml:"packages"`
SkipChangelogTrailer string `yaml:"skip-changelog-trailer"`
// TagFormat locates the previous release tag and, in multi mode
// (ticket 06+), the {{package}} placeholder scopes it per Package. In
// single mode {{package}} is accepted but unused.
TagFormat string `yaml:"tag-format"`
Template string `yaml:"template"`
// footer to every rendered changelog body. A pointer so Load can tell
// "not set in this repo's config" (nil, keep Default's true) apart
// from an explicit "footer: false" (set, false) — a plain bool can't
// make that distinction, since both read as the zero value.
Footer *bool `yaml:"footer"`
}
Config is the fully-defaulted result of loading .draftsman.yml.
func Default ¶
func Default() *Config
Default returns the built-in configuration used when no field is overridden — this is also what a repo with no .draftsman.yml gets.
func Load ¶
Load reads path and applies any fields it sets on top of Default(). A missing file is only an error when required is true — callers should pass required = true exactly when the path was explicitly requested (e.g. an explicit --config flag), so an absent default path silently falls back to defaults while an absent explicit path is a real error.
func (*Config) FooterEnabled ¶ added in v0.2.0
FooterEnabled reports whether c.Footer's attribution footer should be appended. A nil Footer (any Config not built through Default/Load, e.g. a test-constructed literal) defaults to true, same as Default's own value — callers never need to nil-check Footer themselves.