file

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ErrLineNotFound is the error message when no matching line found
	ErrLineNotFound string = "line not found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	File    string
	Line    Line
	Content string
}

File defines the resource file that can be configured from an updatecli configuration

func (*File) Condition

func (f *File) Condition(source string) (bool, error)

Condition test if a file content match the content provided via configuration. If the configuration doesn't specify a value then it fall back to the source output

func (*File) ConditionFromSCM

func (f *File) ConditionFromSCM(source string, scm scm.Scm) (bool, error)

ConditionFromSCM test if a file content from SCM match the content provided via configuration. If the configuration doesn't specify a value then it fall back to the source output

func (*File) Source

func (f *File) Source(workingDir string) (string, error)

Source return a file content

func (*File) Target

func (f *File) Target(source string, dryRun bool) (changed bool, err error)

Target creates or updates a file located locally. The default content is the value retrieved from source

func (*File) TargetFromSCM

func (f *File) TargetFromSCM(source string, scm scm.Scm, dryRun bool) (changed bool, files []string, message string, err error)

TargetFromSCM creates or updates a file from a source control management system. The default content is the value retrieved from source

type Line

type Line struct {
	HasIncludes []string
	Includes    []string
	Excludes    []string
}

Line hold rule that define if a specific line should be included or excluded

func (*Line) ContainsExcluded

func (l *Line) ContainsExcluded(content string) (output string, err error)

ContainsExcluded return a content without excluded lines

func (*Line) ContainsIncluded

func (l *Line) ContainsIncluded(content string) (output string, err error)

ContainsIncluded return a content with only matching lines

func (*Line) HasIncluded

func (l *Line) HasIncluded(content string) (found bool, err error)

HasIncluded return an error content with only matching lines

Jump to

Keyboard shortcuts

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