Documentation
¶
Index ¶
- Variables
- func Diff(ctx context.Context, opts ...DiffOption) (string, error)
- func LatestTag(ctx context.Context, opts ...LatestTagOption) (string, error)
- func LatestVersion(ctx context.Context, opts ...LatestVersionOption) (string, error)
- func ListTags(ctx context.Context, opts ...ListTagsOption) ([]string, error)
- func RevParse(ctx context.Context, opts ...RevParseOption) (string, error)
- func Status(ctx context.Context, opts ...StatusOption) (string, error)
- type DiffConfig
- type DiffFormat
- type DiffOption
- type LatestTagConfig
- type LatestTagOption
- type LatestVersionConfig
- type LatestVersionOption
- type ListTagsConfig
- type ListTagsOption
- type RevParseConfig
- type RevParseFormat
- type RevParseOption
- type SortKey
- type StatusConfig
- type StatusFormat
- type StatusOption
- type WithDiffFormat
- type WithRevParseFormat
- type WithSortKey
- type WithSorted
- type WithStatusFormat
- type WithWorkingDirectory
- func (w WithWorkingDirectory) ConfigureDiff(c *DiffConfig)
- func (w WithWorkingDirectory) ConfigureLatestTag(c *LatestTagConfig)
- func (w WithWorkingDirectory) ConfigureLatestVersion(c *LatestVersionConfig)
- func (w WithWorkingDirectory) ConfigureListTags(c *ListTagsConfig)
- func (w WithWorkingDirectory) ConfigureRevParse(c *RevParseConfig)
- func (w WithWorkingDirectory) ConfigureStatus(c *StatusConfig)
Constants ¶
This section is empty.
Variables ¶
var ErrNoTagsFound = errors.New("no tags found")
ErrNoTagsFound is returned when no tags are found in the current git repository
Functions ¶
func Diff ¶ added in v0.6.0
func Diff(ctx context.Context, opts ...DiffOption) (string, error)
Diff returns the current diff of the git repository with a specified format and variadic slice of options. An error is returned if the diff cannot be retrieved.
func LatestTag ¶
func LatestTag(ctx context.Context, opts ...LatestTagOption) (string, error)
LatestTag returns the latest tag for the current git repository given a variadic slice of options. An error is returned if the latest tag cannot be retrieved.
func LatestVersion ¶ added in v0.6.0
func LatestVersion(ctx context.Context, opts ...LatestVersionOption) (string, error)
LatestVersion returns the latest tag, "v" prefixed, as determined by comparing all tags as semantic versions. An error will be returned if there are no available tags or any tag is not parseable as a semantic version.
func ListTags ¶
func ListTags(ctx context.Context, opts ...ListTagsOption) ([]string, error)
ListTags lists all tags in the current git repository given a variadic slice of options. An error is returned if the the tags cannot be listed.
Types ¶
type DiffConfig ¶ added in v0.6.0
type DiffConfig struct { Format DiffFormat WorkingDir string }
func (*DiffConfig) Option ¶ added in v0.6.0
func (c *DiffConfig) Option(opts ...DiffOption)
type DiffFormat ¶ added in v0.6.0
type DiffFormat string
const ( // DiffFormatNameOnly returns only the names // of modified files. DiffFormatNameOnly DiffFormat = "name only" // DiffFormatNameStatus returns both the name // and type of change for modified files. DiffFormatNameStatus DiffFormat = "name status" )
func (DiffFormat) ToGitValue ¶ added in v0.6.0
func (f DiffFormat) ToGitValue() string
type DiffOption ¶ added in v0.6.0
type DiffOption interface {
ConfigureDiff(*DiffConfig)
}
type LatestTagConfig ¶
type LatestTagConfig struct {
WorkingDir string
}
func (*LatestTagConfig) Option ¶
func (c *LatestTagConfig) Option(opts ...LatestTagOption)
type LatestTagOption ¶
type LatestTagOption interface {
ConfigureLatestTag(*LatestTagConfig)
}
type LatestVersionConfig ¶ added in v0.6.0
type LatestVersionConfig struct {
WorkingDir string
}
func (*LatestVersionConfig) Option ¶ added in v0.6.0
func (c *LatestVersionConfig) Option(opts ...LatestVersionOption)
type LatestVersionOption ¶ added in v0.6.0
type LatestVersionOption interface {
ConfigureLatestVersion(*LatestVersionConfig)
}
type ListTagsConfig ¶
func (*ListTagsConfig) Option ¶
func (c *ListTagsConfig) Option(opts ...ListTagsOption)
type ListTagsOption ¶
type ListTagsOption interface {
ConfigureListTags(c *ListTagsConfig)
}
type RevParseConfig ¶
type RevParseConfig struct { Format RevParseFormat WorkingDir string }
func (*RevParseConfig) Option ¶
func (c *RevParseConfig) Option(opts ...RevParseOption)
type RevParseFormat ¶
type RevParseFormat string
RevParseFormat is an enum of format options for "git rev-parse"
const ( // RevParseFormatAbbrevRef is "--abbrev-ref" RevParseFormatAbbrevRef RevParseFormat = "abbrev-ref" // RevParseFormatShort is "--short" RevParseFormatShort RevParseFormat = "short" // RevParseFormatTopLevel is "--show-toplevel" RevParseFormatTopLevel RevParseFormat = "top-level" )
func (RevParseFormat) ToGitValue ¶
func (f RevParseFormat) ToGitValue() string
type RevParseOption ¶
type RevParseOption interface {
ConfigureRevParse(*RevParseConfig)
}
type StatusConfig ¶ added in v0.6.0
type StatusConfig struct { Format StatusFormat WorkingDir string }
func (*StatusConfig) Option ¶ added in v0.6.0
func (c *StatusConfig) Option(opts ...StatusOption)
type StatusFormat ¶ added in v0.6.0
type StatusFormat string
const ( // StatusFormatLong returns the long form of status. StatusFormatLong StatusFormat = "long" // StatusFormatPorcelain returns a consistent // status without terminal control codes. StatusFormatPorcelain StatusFormat = "porcelain" // StatusFormatShort returns the short form of status StatusFormatShort StatusFormat = "short" )
func (StatusFormat) ToGitValue ¶ added in v0.6.0
func (f StatusFormat) ToGitValue() string
type StatusOption ¶ added in v0.6.0
type StatusOption interface {
ConfigureStatus(*StatusConfig)
}
type WithDiffFormat ¶ added in v0.6.1
type WithDiffFormat DiffFormat
WithDiffFormat applies the given DiffFormat
func (WithDiffFormat) ConfigureDiff ¶ added in v0.6.1
func (w WithDiffFormat) ConfigureDiff(c *DiffConfig)
type WithRevParseFormat ¶ added in v0.6.1
type WithRevParseFormat RevParseFormat
WithRevParseFormat applies the given RevParseFormat
func (WithRevParseFormat) ConfigureRevParse ¶ added in v0.6.1
func (w WithRevParseFormat) ConfigureRevParse(c *RevParseConfig)
type WithSortKey ¶
type WithSortKey SortKey
With SortKey applies the given sort key.
func (WithSortKey) ConfigureListTags ¶
func (w WithSortKey) ConfigureListTags(c *ListTagsConfig)
type WithSorted ¶
type WithSorted bool
WithSorted enables sorting.
func (WithSorted) ConfigureListTags ¶
func (w WithSorted) ConfigureListTags(c *ListTagsConfig)
type WithStatusFormat ¶ added in v0.6.1
type WithStatusFormat StatusFormat
WithStatusFormat applies the given StatusFormat
func (WithStatusFormat) ConfigureStatus ¶ added in v0.6.1
func (w WithStatusFormat) ConfigureStatus(c *StatusConfig)
type WithWorkingDirectory ¶
type WithWorkingDirectory string
WithWorkingDirectory applies the given working directory.
func (WithWorkingDirectory) ConfigureDiff ¶ added in v0.6.0
func (w WithWorkingDirectory) ConfigureDiff(c *DiffConfig)
func (WithWorkingDirectory) ConfigureLatestTag ¶
func (w WithWorkingDirectory) ConfigureLatestTag(c *LatestTagConfig)
func (WithWorkingDirectory) ConfigureLatestVersion ¶ added in v0.6.0
func (w WithWorkingDirectory) ConfigureLatestVersion(c *LatestVersionConfig)
func (WithWorkingDirectory) ConfigureListTags ¶
func (w WithWorkingDirectory) ConfigureListTags(c *ListTagsConfig)
func (WithWorkingDirectory) ConfigureRevParse ¶
func (w WithWorkingDirectory) ConfigureRevParse(c *RevParseConfig)
func (WithWorkingDirectory) ConfigureStatus ¶ added in v0.6.0
func (w WithWorkingDirectory) ConfigureStatus(c *StatusConfig)