diff

package
v1.13.13-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdDiff

func NewCmdDiff(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command

func RunDiff

func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions) error

RunDiff uses the factory to parse file arguments, find the version to diff, and find each Info object for each files, and runs against the differ.

Types

type DiffOptions

type DiffOptions struct {
	FilenameOptions resource.FilenameOptions
}

type DiffProgram

type DiffProgram struct {
	Exec exec.Interface
	genericclioptions.IOStreams
}

DiffProgram finds and run the diff program. The value of KUBECTL_EXTERNAL_DIFF environment variable will be used a diff program. By default, `diff(1)` will be used.

func (*DiffProgram) Run

func (d *DiffProgram) Run(from, to string) error

Run runs the detected diff program. `from` and `to` are the directory to diff.

type DiffVersion

type DiffVersion struct {
	Dir  *Directory
	Name string
}

DiffVersion gets the proper version of objects, and aggregate them into a directory.

func NewDiffVersion

func NewDiffVersion(name string) (*DiffVersion, error)

NewDiffVersion creates a new DiffVersion with the named version.

func (*DiffVersion) Print

func (v *DiffVersion) Print(obj Object, printer Printer) error

Print prints the object using the printer into a new file in the directory.

type Differ

type Differ struct {
	From *DiffVersion
	To   *DiffVersion
}

Differ creates two DiffVersion and diffs them.

func NewDiffer

func NewDiffer(from, to string) (*Differ, error)

func (*Differ) Diff

func (d *Differ) Diff(obj Object, printer Printer) error

Diff diffs to versions of a specific object, and print both versions to directories.

func (*Differ) Run

func (d *Differ) Run(diff *DiffProgram) error

Run runs the diff program against both directories.

func (*Differ) TearDown

func (d *Differ) TearDown()

TearDown removes both temporary directories recursively.

type Directory

type Directory struct {
	Name string
}

Directory creates a new temp directory, and allows to easily create new files.

func CreateDirectory

func CreateDirectory(prefix string) (*Directory, error)

CreateDirectory does create the actual disk directory, and return a new representation of it.

func (*Directory) Delete

func (d *Directory) Delete() error

Delete removes the directory recursively.

func (*Directory) NewFile

func (d *Directory) NewFile(name string) (*os.File, error)

NewFile creates a new file in the directory.

type InfoObject

type InfoObject struct {
	LocalObj runtime.Object
	Info     *resource.Info
	Encoder  runtime.Encoder
	OpenAPI  openapi.Resources
	Force    bool
}

InfoObject is an implementation of the Object interface. It gets all the information from the Info object.

func (InfoObject) Live

func (obj InfoObject) Live() runtime.Object

Returns the live version of the object

func (InfoObject) Merged

func (obj InfoObject) Merged() (runtime.Object, error)

Returns the "merged" object, as it would look like if applied or created.

func (InfoObject) Name

func (obj InfoObject) Name() string

type Object

type Object interface {
	Live() runtime.Object
	Merged() (runtime.Object, error)

	Name() string
}

Object is an interface that let's you retrieve multiple version of it.

type Printer

type Printer struct{}

Printer is used to print an object.

func (*Printer) Print

func (p *Printer) Print(obj runtime.Object, w io.Writer) error

Print the object inside the writer w.

Jump to

Keyboard shortcuts

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