diff

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Files

type Files struct {
	From, To *Version
}

Files is a compound handle for multiple directories and files that shall be compared using a diff program. This is similar to how `kubectl diff` works. This should behave similarly (e.g., create files in two different directories) as some external diff tools might have some heuristic detections in places, e.g., see dyff: https://github.com/homeport/dyff/blame/c382d5132c86d2280335f4cb71754ab20776a85a/internal/cmd/root.go#L85-L98

func NewFiles

func NewFiles(from, to string) (f *Files, err error)

NewFiles creates two Version handles (i.e., two temporary directories).

func (Files) TearDown

func (f Files) TearDown() error

TearDown removes any temporary directories held by this handle.

type Program

type Program interface {
	// Run executes the diff program to compare the given files.
	Run(a, b string) error
}

Program is a diff program that compares two files.

func NewProgram

func NewProgram(streams genericiooptions.IOStreams) Program

NewProgram returns kubectl's default Program implementation that respects the KUBECTL_EXTERNAL_DIFF environment variable. It falls back to `diff -u -N` if the env var is unset.

type Version added in v0.2.0

type Version struct {
	Dir string
}

Version is a handle for a directory that can hold multiple files of a single version to compare.

func NewVersion added in v0.2.0

func NewVersion(name string) (*Version, error)

NewVersion creates a temporary directory.

func (*Version) Print added in v0.2.0

func (v *Version) Print(name string, obj runtime.Object, printer printers.ResourcePrinter) (err error)

Print prints the given object using the given printer to a file with the specified name in Version.Dir.

func (*Version) TearDown added in v0.2.0

func (v *Version) TearDown() error

TearDown removes the temporary directory held by this handle.

Jump to

Keyboard shortcuts

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