cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const VersionString = "csvdiff v1.0.0"

VersionString to display on --version call

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.

Types

type Config

type Config struct {
	PrimaryKeyPositions  []int
	ValueColumnPositions []int
	Format               string
}

Config is to store all command line Flags.

func (*Config) Formatter added in v1.0.0

func (c *Config) Formatter() Formatter

Formatter instantiates a new formatted based on config.Format

func (*Config) GetPrimaryKeys

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

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

func (*Config) GetValueColumns

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

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

func (*Config) Validate added in v1.0.0

func (c *Config) Validate() error

Validate validates the config object and returns error if not valid.

type Formatter added in v1.0.0

type Formatter interface {
	Format(digest.Difference, io.Writer)
}

Formatter defines the interface through which differences can be formatted and displayed

type JSONFormatter added in v1.0.0

type JSONFormatter struct{}

JSONFormatter formats diff to as a JSON Object

func (*JSONFormatter) Format added in v1.0.0

func (f *JSONFormatter) Format(diff digest.Difference, w io.Writer)

Format prints the diff as a JSON

type RowMarkFormatter added in v1.0.0

type RowMarkFormatter struct{}

RowMarkFormatter formats diff by marking each row as ADDED/MODIFIED. It mutates the row and adds as a new column.

func (*RowMarkFormatter) Format added in v1.0.0

func (f *RowMarkFormatter) Format(diff digest.Difference, w io.Writer)

Format prints the diff to os.Stdout

Jump to

Keyboard shortcuts

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