cmd

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfigFile = "gatecheck.yaml"
View Source
const DefaultReportFile = "gatecheck-report.json"
View Source
View Source
const VersionNumber = "0.0.5"

Variables

View Source
var ErrorDecode = errors.New("error decoding a file")
View Source
var ErrorEncode = errors.New("error encoding a file")
View Source
var ErrorFileAccess = errors.New("file access error")
View Source
var ErrorFileExists = errors.New("file already exists")
View Source
var ErrorFileNotExists = errors.New("file does not exists")
View Source
var ErrorValidation = errors.New("report failed validation")

Functions

func NewConfigCmd added in v0.0.2

func NewConfigCmd() *cobra.Command

func NewExportCmd added in v0.0.2

func NewExportCmd(e exporter.Exporter) *cobra.Command

func NewReportCmd added in v0.0.2

func NewReportCmd(configFile *string, reportFile *string) *cobra.Command

func NewRootCmd added in v0.0.2

func NewRootCmd(e exporter.Exporter) *cobra.Command

func NewValidateCmd added in v0.0.2

func NewValidateCmd(configFile *string, reportFile *string) *cobra.Command

func Open added in v0.0.5

func Open(filename string) (io.Reader, error)

Open is a wrapper function for os.Open with cmd specific errors

func OpenAll added in v0.0.5

func OpenAll(filenames ...string) ([]io.Reader, error)

OpenAll can be used to open multiple files at once

func OpenAndDecode added in v0.0.5

func OpenAndDecode[T any](filename string, fileType FileType) (*T, error)

OpenAndDecode opens a file and decodes it into the desired object

func OpenAndDecodeOrCreate added in v0.0.5

func OpenAndDecodeOrCreate[T any](filename string, fileType FileType) (*T, error)

OpenAndDecodeOrCreate will return a new object if the file did not exist. Will not write the file

func OpenAndEncode added in v0.0.5

func OpenAndEncode(filename string, fileType FileType, object any) error

OpenAndEncode opens a file and encodes the object based in the fileType format

func OpenOrCreate added in v0.0.5

func OpenOrCreate(filename string) (io.ReadWriter, error)

OpenOrCreate if the file doesn't exist it will be created

func OpenOrCreateInDirectory added in v0.0.5

func OpenOrCreateInDirectory(directoryOrFilename string, FilenameIfDirectory string) (io.ReadWriter, error)

OpenOrCreateInDirectory can be used to create new files by passing a filename or the name of a directory. If the name of an existing directory is passed, a new file will be created in that directory

Types

type Decoder added in v0.0.5

type Decoder interface {
	Decode(v any) error
}

type FileType added in v0.0.5

type FileType int
const (
	JSON FileType = iota
	YAML FileType = iota
)

Jump to

Keyboard shortcuts

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