cmd

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func SetVersion added in v1.1.0

func SetVersion(_version string)

SetVersion will set the version of the cmd package

func Version added in v1.1.0

func Version() string

Version will return the set version of cmd package

Types

type Context added in v1.3.0

type Context struct {
	// contains filtered or unexported fields
}

Context is to store all command line Flags.

func NewContext added in v1.3.0

func NewContext(
	fs afero.Fs,
	primaryKeyPositions []int,
	valueColumnPositions []int,
	ignoreValueColumnPositions []int,
	includeColumnPositions []int,
	format string,
	baseFilename string,
	deltaFilename string,
	separator rune,
	lazyQuotes bool,
) (*Context, error)

NewContext can take all CLI flags and create a cmd.Context Validations are done as part of this. File pointers are created too.

func (*Context) BaseDigestConfig added in v1.3.0

func (c *Context) BaseDigestConfig() (digest.Config, error)

BaseDigestConfig creates a digest.Context from cmd.Context that is needed to start the diff process

func (*Context) Close added in v1.3.0

func (c *Context) Close()

Close all file handles

func (*Context) DeltaDigestConfig added in v1.3.0

func (c *Context) DeltaDigestConfig() (digest.Config, error)

DeltaDigestConfig creates a digest.Context from cmd.Context that is needed to start the diff process

func (Context) GetIncludeColumnPositions added in v1.3.0

func (c Context) GetIncludeColumnPositions() digest.Positions

GetIncludeColumnPositions is to return the --include flags as digest.Positions array. If empty, it is value columns

func (*Context) GetPrimaryKeys added in v1.3.0

func (c *Context) GetPrimaryKeys() digest.Positions

GetPrimaryKeys is to return the --primary-key flags as digest.Positions array.

func (*Context) GetValueColumns added in v1.3.0

func (c *Context) GetValueColumns() digest.Positions

GetValueColumns is to return the --columns flags as digest.Positions array.

type Formatter added in v1.0.0

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter can print the differences to stdout and accompanying metadata to stderr

func NewFormatter added in v1.2.0

func NewFormatter(stdout, stderr io.Writer, ctx Context) *Formatter

NewFormatter can be used to create a new formatter

func (*Formatter) Format added in v1.0.0

func (f *Formatter) Format(diff digest.Differences) error

Format can be used to format the differences based on ctx to appropriate writers

Jump to

Keyboard shortcuts

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