types

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Replace        FileExistsAction = "replace"
	Skip           FileExistsAction = "skip"
	ReplaceIfNewer FileExistsAction = "replace_if_newer"

	Commit ChangelogType = "commit"
	Tag    ChangelogType = "tag"

	Include ChangelogConditionType = "include"
	Exclude ChangelogConditionType = "exclude"

	Asc  ChangelogSort = "asc"
	Desc ChangelogSort = "desc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildType

type BuildType string

type Builds

type Builds struct {
	Release     []string `yaml:"release"`
	LastVersion []string `yaml:"lastVersion,omitempty"`
}

type Changelog

type Changelog struct {
	From      TypeValue[ChangelogType, string]            `yaml:"from"`
	To        TypeValue[ChangelogType, string]            `yaml:"to"`
	Sort      ChangelogSort                               `yaml:"sort,omitempty"`
	Condition TypeValue[ChangelogConditionType, []string] `yaml:"condition,omitempty"`
}

type ChangelogConditionType

type ChangelogConditionType string

type ChangelogSort

type ChangelogSort string

type ChangelogType

type ChangelogType string

type Changes

type Changes struct {
	Added    []string
	Modified []string
	Deleted  []string
	Moved    []string
}

func (*Changes) IsChangedFile

func (o *Changes) IsChangedFile(path string) bool

IsChangedFile checks whether the given file path corresponds to a file that has been added or modified.

Parameters:

  • path: The file path to check.

Returns:

  • true if the file is in the list of added or modified files.
  • false otherwise.

Behavior:

  • Iterates through the `Added` and `Modified` slices of the `Changes` struct.
  • Uses `strings.HasSuffix` to check if the provided path ends with any of the added or modified file names.
  • Returns true on the first match, otherwise false.

Notes:

  • This method assumes that `o.Added` and `o.Modified` contain relative or base file names.
  • If files are stored with full paths in `o.Added` and `o.Modified`, this method may produce false negatives.

Example:

changes := Changes{
    Added:    []string{"file1.txt", "dir/file2.go"},
    Modified: []string{"config.yaml"},
}
fmt.Println(changes.IsChangedFile("project/dir/file2.go")) // true
fmt.Println(changes.IsChangedFile("config.yaml"))         // true
fmt.Println(changes.IsChangedFile("untracked.txt"))       // false

type FileExistsAction

type FileExistsAction string

type Stage

type Stage struct {
	Name               string           `yaml:"name"`
	To                 string           `yaml:"to"`
	ActionIfFileExists FileExistsAction `yaml:"actionIfFileExists"`
	From               []string         `yaml:"from"`
	Filter             []string         `yaml:"filter,omitempty"`
	ConvertTo1251      bool             `yaml:"convertTo1251,omitempty"`
}

type TypeValue

type TypeValue[T1 any, T2 any] struct {
	Type  T1 `yaml:"type"`
	Value T2 `yaml:"value"`
}

Jump to

Keyboard shortcuts

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