core

package
v0.0.0-...-e027d2d Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ENTRY_SEPARATOR string = "----------------------------------------------------------------------------------------------------"

Variables

This section is empty.

Functions

func CheckUntrackedFiles

func CheckUntrackedFiles(fileName string) ([]string, int, error)

func GetAllDiff

func GetAllDiff(commitAmount uint) (string, error)

func GetLockfilesFromDiff

func GetLockfilesFromDiff(lockfileDiffFile *diffparser.DiffFile) (string, string)

func GetPrevCommitHash

func GetPrevCommitHash() (string, error)

func GetRootFile

func GetRootFile(lockfilePath string, rootFileName string) (string, error)

func GetSingleDiff

func GetSingleDiff(filePath string, commitAmount uint) (string, error)

func IndexOf

func IndexOf(slice []string, find string) int

func Log

func Log(fileName string, diff string, override bool) error

func RenderHumanReadable

func RenderHumanReadable(diffList *[]Diff) string

func RenderJSON

func RenderJSON(diffList *[]Diff) (string, error)

Types

type AbsentFieldDiff

type AbsentFieldDiff struct {
	Type     DiffType     `json:"type"`
	MetaType DiffMetaType `json:"meta_type"`
	Name     string       `json:"dependency_name"`
	Field    string       `json:"field"`
}

func MakeAbsentFieldDiff

func MakeAbsentFieldDiff(pkgName string, field string) AbsentFieldDiff

func (AbsentFieldDiff) GetName

func (diff AbsentFieldDiff) GetName() string

func (AbsentFieldDiff) GetType

func (diff AbsentFieldDiff) GetType() DiffType

func (AbsentFieldDiff) RenderHumanReadable

func (diff AbsentFieldDiff) RenderHumanReadable() string

type DependencyDiff

type DependencyDiff struct {
	Type     DiffType     `json:"type"`
	MetaType DiffMetaType `json:"meta_type"`
	Name     string       `json:"dependency_name"`
	Parent   string       `json:"parent"`
	Version  string       `json:"version,omitempty"`
}

func MakeAddedDependencyDiff

func MakeAddedDependencyDiff(pkgName string, version string, parent string) DependencyDiff

func MakeAddedSubDependencyDiff

func MakeAddedSubDependencyDiff(pkgName string, parent string, version string) DependencyDiff

func MakeModifiedSubDependencyDiff

func MakeModifiedSubDependencyDiff(pkgName string, parent string) DependencyDiff

func MakeRemovedDependencyDiff

func MakeRemovedDependencyDiff(pkgName string) DependencyDiff

func MakeRemovedSubDependencyDiff

func MakeRemovedSubDependencyDiff(pkgName, parent string) DependencyDiff

func (DependencyDiff) GetName

func (diff DependencyDiff) GetName() string

func (DependencyDiff) GetType

func (diff DependencyDiff) GetType() DiffType

func (DependencyDiff) RenderHumanReadable

func (diff DependencyDiff) RenderHumanReadable() string

type Diff

type Diff interface {
	RenderHumanReadable() string
	GetType() DiffType
	GetName() string
}

type DiffMetaType

type DiffMetaType string
const (
	DEPENDENCY     DiffMetaType = "dependency"
	SUB_DEPENDENCY DiffMetaType = "sub-dependency"
	FIELD          DiffMetaType = "field"
)

type DiffType

type DiffType string
const (
	ADDED    DiffType = "added"
	MODIFIED DiffType = "modified"
	REMOVED  DiffType = "removed"
)

type FieldDiff

type FieldDiff struct {
	Type     DiffType     `json:"type"`
	MetaType DiffMetaType `json:"meta_type"`
	Name     string       `json:"dependency_name"`
	Field    string       `json:"field"`
	OldValue string       `json:"old_value"`
	NewValue string       `json:"new_value"`
}

func MakeDependencyFieldDiff

func MakeDependencyFieldDiff(
	pkgName string,
	fieldName string,
	oldVal string,
	newVal string,
) FieldDiff

func (FieldDiff) GetName

func (diff FieldDiff) GetName() string

func (FieldDiff) GetType

func (diff FieldDiff) GetType() DiffType

func (FieldDiff) RenderHumanReadable

func (diff FieldDiff) RenderHumanReadable() string

type LockFileType

type LockFileType struct {
	FileName string
	Format   string
	RootFile string
}

func GetLockfileType

func GetLockfileType(lockfileType string) (LockFileType, error)

Jump to

Keyboard shortcuts

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