config

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config implements tag's config file functionality.

Tag can operate perfectly well without a config file, but it's used to specify hooks, custom commit and tag messages and to configure search and replace on version bumping for e.g. project metadata

Index

Constants

View Source
const Filename = ".tag.toml"

Filename is the canonical file name for tag's config file.

Variables

View Source
var ErrNoConfigFile = errors.New("config file not found")

ErrNoConfigFile is the signal that no config file exists.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version string `toml:"version"`
	Git     Git    `toml:"git,omitempty"`
	Hooks   Hooks  `toml:"hooks,omitempty"`
	Files   []File `toml:"file,omitempty"`
}

Config represents tags configuration settings.

func Load

func Load(path string) (Config, error)

Load reads Config from a file.

func (*Config) Render

func (c *Config) Render(current, next string) error

Render replaces the special values {{.Current}} and {{.Next}} in the search and replace templates as well as the commit and tag messages.

func (Config) Save added in v0.4.0

func (c Config) Save(path string) error

Save saves the config to disk.

type File

type File struct {
	Path   string `toml:"path,omitempty"`
	Search string `toml:"search,omitempty"`

	Replace string `toml:"-,omitempty"` // Not part of the config, inferred from `Search`
}

File represents a single file tag should perform search and replace on.

type Git added in v0.4.0

type Git struct {
	DefaultBranch   string `toml:"default-branch,omitempty"`
	MessageTemplate string `toml:"message-template,omitempty"`
	TagTemplate     string `toml:"tag-template,omitempty"`
}

Git represents the git config in tag's config file.

type Hooks added in v0.4.0

type Hooks struct {
	PreReplace string `toml:"pre-replace,omitempty"`
	PreCommit  string `toml:"pre-commit,omitempty"`
	PreTag     string `toml:"pre-tag,omitempty"`
	PrePush    string `toml:"pre-push,omitempty"`
}

Hooks encodes the optional hooks specified in tag's config file.

Jump to

Keyboard shortcuts

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