config package - github.com/sudo-bmitch/version-bump/internal/config - Go Packages

config

package
v0.0.0-...-2f341f2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config defines the config file and load methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version    int                   `yaml:"version" json:"version"`
	Files      map[string]*File      `yaml:"files" json:"files"`
	Processors map[string]*Processor `yaml:"processors" json:"processors"`
	Scans      map[string]*Scan      `yaml:"scans" json:"scans"`
	Sources    map[string]*Source    `yaml:"sources" json:"sources"`
}

Config contains the configuration options for the project

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile imports a config from a filename

func LoadReader

func LoadReader(r io.Reader) (*Config, error)

LoadReader imports a config from a reader.

func New

func New() *Config

New creates an empty config

type File

type File struct {
	Name       string   `yaml:"-" json:"-"`                   // Name is a filename or glob to match against
	Processors []string `yaml:"processors" json:"processors"` // Processors to run on a given file
	Scans      []string `yaml:"scans" json:"scans"`           // Deprecated: Scans are Scan names to apply to the file
}

File defines a file to process for version bumps.

type Filter

type Filter struct {
	Expr string `yaml:"expr" json:"expr"` // Regexp to match, Go templating is enabled on this

}

Filter defines how items are filtered in from the source. By default, all items are included.

type Processor

type Processor struct {
	Name       string            `yaml:"-" json:"-"`                   // Name of the processor
	Scan       string            `yaml:"scan" json:"scan"`             // Scanner to use
	ScanArgs   map[string]string `yaml:"scanArgs" json:"scanArgs"`     // Args to scanner
	Source     string            `yaml:"source" json:"source"`         // Source to use
	SourceArgs map[string]string `yaml:"sourceArgs" json:"sourceArgs"` // Args to source
	Key        string            `yaml:"key" json:"key"`               // Key is a unique value to store in a lock file
	Filter     Filter            `yaml:"filter" json:"filter"`         // Filter specifies which items to include from the source
	Sort       Sort              `yaml:"sort" json:"sort"`             // Sort is used to pick from multiple results
	Template   string            `yaml:"template" json:"template"`     // Template is used to output the version
}

Processor scans with a selected scanner and source.

func (Processor) Clone

func (p Processor) Clone() Processor

func (Processor) Equal

func (p Processor) Equal(p2 Processor) bool

type Scan

type Scan struct {
	Name   string            `yaml:"-" json:"-"`           // Name is the name of the scan entry
	Type   string            `yaml:"type" json:"type"`     // Type is the method for scanning the file
	Args   map[string]string `yaml:"args" json:"args"`     // Args provide additional options used by scanners, sources, and templating
	Source string            `yaml:"source" json:"source"` // Deprecated: Source is the name of the source for updating the version
}

Scan defines how to search a file for versions.

func (Scan) Clone

func (s Scan) Clone() Scan

func (Scan) Equal

func (s Scan) Equal(s2 Scan) bool

type Sort

type Sort struct {
	Method   string `yaml:"method" json:"method"`     // Sorting methods include: semver, numeric, or unset for an ascii sort
	Asc      bool   `yaml:"asc" json:"asc"`           // Sort values ascending (smallest number first)
	Offset   int    `yaml:"offset" json:"offset"`     // Offset within the sorted values to pick
	Template string `yaml:"template" json:"template"` // Preprocess value to be sorted, this does not effect the resulting version number only the sorting
}

Sort defines how multiple results should be filtered and sorted. By default, sort returns the 0 offset of a descending sort.

type Source

type Source struct {
	Name     string            `yaml:"-" json:"-"`               // Name is the name of the source entry
	Type     string            `yaml:"type" json:"type"`         // Type is the method used to query the source
	Args     map[string]string `yaml:"args" json:"args"`         // Args provide additional options used by sources
	Key      string            `yaml:"key" json:"key"`           // Deprecated: Key is a unique value to store in a lock file
	Filter   Filter            `yaml:"filter" json:"filter"`     // Deprecated: Filter specifies which items to include from the source
	Sort     Sort              `yaml:"sort" json:"sort"`         // Deprecated: Sort is used to pick from multiple results
	Template string            `yaml:"template" json:"template"` // Deprecated: Template is used to output the version
}

Source defines how to get the current version.

func (Source) Clone

func (s Source) Clone() Source

func (Source) Equal

func (s Source) Equal(s2 Source) bool

Jump to

Keyboard shortcuts

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