common

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string = "unknown"

Functions

func FailWith

func FailWith(message string)

FailWith exits with an error message controllably

Types

type EnvSource

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

func NewEnvSource

func NewEnvSource(varName string) *EnvSource

func (*EnvSource) Orig

func (s *EnvSource) Orig() string

func (*EnvSource) Source

func (s *EnvSource) Source() string

func (*EnvSource) Values

func (s *EnvSource) Values() []string

type Filesystem

type Filesystem interface {
	GetAbsolutePath(path string) string
	PathStatus(path string) (bool, bool)
}

type OsFilesystem

type OsFilesystem struct{}

func (*OsFilesystem) GetAbsolutePath

func (*OsFilesystem) GetAbsolutePath(path string) string

func (*OsFilesystem) PathStatus

func (f *OsFilesystem) PathStatus(path string) (bool, bool)

returns (exists, isDir)

type Output

type Output string
const (
	OutputInteractive Output = "interactive" // default
	OutputTable       Output = "table"
	OutputJSON        Output = "json"
	OutputCSV         Output = "csv"
)

func (*Output) Set

func (e *Output) Set(v string) error

func (*Output) String

func (e *Output) String() string

func (*Output) Type

func (e *Output) Type() string

type ResultRow

type ResultRow struct {
	Id           int    `json:"id"`
	Path         string `json:"path"`
	ExpandedPath string `json:"expanded_path"`
	Exists       bool   `json:"exists"`
	IsDir        bool   `json:"is_dir"`
	Duplicates   []int  `json:"duplicates"`
}

func CalculateResults

func CalculateResults(fs Filesystem, source ValueSource) ([]ResultRow, error)

type ValueSource

type ValueSource interface {
	Source() string
	Orig() string
	Values() []string
}

Jump to

Keyboard shortcuts

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