shared

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug bool

	OutputFormat = argtype.NewStringSet("OutputFormat", "text", []string{"text", "json", "markdown", "filenames"})
)
View Source
var (
	DEFAULT_IGNORE_FILE = ".gitignore"
)

Functions

func AddCommon

func AddCommon(rootCmd *cobra.Command)

func EncodeJSON

func EncodeJSON(data interface{}) string

func ErrString

func ErrString(maybeErr error) any

func IfThenElse

func IfThenElse(condition bool, a interface{}, b interface{}) interface{}

IfThenElse is a substitute for golang missing a ternary operator

func MakeFileCommand

func MakeFileCommand(checkFn func(*FileContext)) func(cmd *cobra.Command, args []string) error

func ProgressCount

func ProgressCount()

ProgressCount called when loading the list (before end is known)

func ProgressEnd

func ProgressEnd()

ProgressEnd call when completely done

func ProgressStart

func ProgressStart(fcs []FileContext)

ProgressStart start the progress bar

func ProgressUpdate

func ProgressUpdate(good int, bad int, fc FileContext)

ProgressUpdate update the progress bar

Types

type ErrorAtPosition

type ErrorAtPosition struct {
	Position int
	Err      error
}

func NewErrorAtPosition

func NewErrorAtPosition(err error, pos int) *ErrorAtPosition

func (*ErrorAtPosition) Error

func (eap *ErrorAtPosition) Error() string

type FileContext

type FileContext struct {
	FilePath string
	// contains filtered or unexported fields
}

FileContext data about a file being tested

func (*FileContext) IsDir

func (fc *FileContext) IsDir() bool

IsDir if it is a directory

func (*FileContext) IsFile

func (fc *FileContext) IsFile() bool

IsFile if it is a file

func (*FileContext) ReadFile

func (fc *FileContext) ReadFile() ([]byte, error)

ReadFile ioutil.ReadFile, possibly cached

func (*FileContext) RecordResult

func (fc *FileContext) RecordResult(Code string, Success bool, Detail map[string]interface{})

func (*FileContext) Reset

func (fc *FileContext) Reset()

func (*FileContext) Size

func (fc *FileContext) Size() int64

func (*FileContext) Stat

func (fc *FileContext) Stat() (os.FileInfo, error)

Stat os.Stat, possibly cached

func (*FileContext) Success

func (fc *FileContext) Success() bool

type Globber

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

Globber is an optional min/max pair

func (*Globber) Set

func (g *Globber) Set(newValue string) error

Set the glob algorithm

func (*Globber) String

func (g *Globber) String() string

func (*Globber) Type

func (g *Globber) Type() string

Type is a description of range

type Namespaces

type Namespaces struct {
	Default    string
	Additional map[string]string
}

func GetNamespaces

func GetNamespaces(reader io.Reader) (Namespaces, error)

type SchemaOptions

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

func (*SchemaOptions) AddFlags

func (so *SchemaOptions) AddFlags(theCmd *cobra.Command)

func (*SchemaOptions) Prepare

func (so *SchemaOptions) Prepare() error

func (*SchemaOptions) Validate

func (so *SchemaOptions) Validate(data interface{}) error

type TestResult

type TestResult struct {
	Code    string
	Success bool
	Detail  map[string]interface{}
}

TestResult is results of a single test

Jump to

Keyboard shortcuts

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