tagmanager

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegisterTagManagerFn = registerTagManager
	GetTagManagerFn      = getTagManager
)

Functions

func DeleteTag

func DeleteTag(name string) error

DeleteTag deletes a local git tag.

func ListTags

func ListTags(pattern string) ([]string, error)

ListTags returns all git tags matching a pattern.

func Register

func Register(cfg *Config)

Register registers the tag manager plugin with the given configuration.

func ResetTagManager

func ResetTagManager()

ResetTagManager clears the registered tag manager (for testing).

Types

type Config

type Config struct {
	// Enabled controls whether the plugin is active.
	Enabled bool

	// AutoCreate automatically creates tags after version bumps.
	AutoCreate bool

	// Prefix is the tag prefix (default: "v").
	Prefix string

	// Annotate creates annotated tags instead of lightweight tags.
	Annotate bool

	// Push automatically pushes tags to remote after creation.
	Push bool
}

Config holds configuration for the tag manager plugin.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default tag manager configuration.

type OSGitTagOperations

type OSGitTagOperations struct {
	// contains filtered or unexported fields
}

OSGitTagOperations implements core.GitTagOperations using actual git commands.

func NewOSGitTagOperations

func NewOSGitTagOperations() *OSGitTagOperations

NewOSGitTagOperations creates a new OSGitTagOperations with the default exec.Command.

func (*OSGitTagOperations) CreateAnnotatedTag

func (g *OSGitTagOperations) CreateAnnotatedTag(name, message string) error

func (*OSGitTagOperations) CreateLightweightTag

func (g *OSGitTagOperations) CreateLightweightTag(name string) error

func (*OSGitTagOperations) GetLatestTag

func (g *OSGitTagOperations) GetLatestTag() (string, error)

func (*OSGitTagOperations) PushTag

func (g *OSGitTagOperations) PushTag(name string) error

func (*OSGitTagOperations) TagExists

func (g *OSGitTagOperations) TagExists(name string) (bool, error)

type TagManager

type TagManager interface {
	Name() string
	Description() string
	Version() string

	// CreateTag creates a git tag for the given version.
	CreateTag(version semver.SemVersion, message string) error

	// TagExists checks if a tag for the given version already exists.
	TagExists(version semver.SemVersion) (bool, error)

	// GetLatestTag returns the latest semver tag from git.
	GetLatestTag() (semver.SemVersion, error)

	// ValidateTagAvailable ensures a tag can be created for the version.
	ValidateTagAvailable(version semver.SemVersion) error

	// FormatTagName formats a version as a tag name.
	FormatTagName(version semver.SemVersion) string
}

TagManager defines the interface for git tag operations.

type TagManagerPlugin

type TagManagerPlugin struct {
	// contains filtered or unexported fields
}

TagManagerPlugin implements the TagManager interface.

func NewTagManager

func NewTagManager(cfg *Config) *TagManagerPlugin

NewTagManager creates a new tag manager plugin with the given configuration.

func (*TagManagerPlugin) CreateTag

func (p *TagManagerPlugin) CreateTag(version semver.SemVersion, message string) error

CreateTag creates a git tag for the given version.

func (*TagManagerPlugin) Description

func (p *TagManagerPlugin) Description() string

func (*TagManagerPlugin) FormatTagName

func (p *TagManagerPlugin) FormatTagName(version semver.SemVersion) string

FormatTagName formats a version as a tag name using the configured prefix.

func (*TagManagerPlugin) GetConfig

func (p *TagManagerPlugin) GetConfig() *Config

GetConfig returns the plugin configuration.

func (*TagManagerPlugin) GetLatestTag

func (p *TagManagerPlugin) GetLatestTag() (semver.SemVersion, error)

GetLatestTag returns the latest semver tag from git.

func (*TagManagerPlugin) IsEnabled

func (p *TagManagerPlugin) IsEnabled() bool

IsEnabled returns whether auto-create is enabled.

func (*TagManagerPlugin) Name

func (p *TagManagerPlugin) Name() string

func (*TagManagerPlugin) TagExists

func (p *TagManagerPlugin) TagExists(version semver.SemVersion) (bool, error)

TagExists checks if a tag for the given version already exists.

func (*TagManagerPlugin) ValidateTagAvailable

func (p *TagManagerPlugin) ValidateTagAvailable(version semver.SemVersion) error

ValidateTagAvailable ensures a tag can be created for the version.

func (*TagManagerPlugin) Version

func (p *TagManagerPlugin) Version() string

Jump to

Keyboard shortcuts

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