common

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string = "unknown"

Functions

func ConvertSimpleVarsToBraces added in v0.3.0

func ConvertSimpleVarsToBraces(input string) string

func CustomExpandVariables added in v0.3.0

func CustomExpandVariables(input string, fn func(key string) (value string, ok bool)) string

func FailWith

func FailWith(message string)

FailWith exits with an error message controllably

func FixHomeExpansion added in v0.3.0

func FixHomeExpansion(path string) string

func ForEachKnownPath added in v0.2.0

func ForEachKnownPath(fn func(string, string))

ForEachKnownPath iterates over expanded known paths if they're legitimate

func ForEachPathsDPath added in v0.2.0

func ForEachPathsDPath(fn func(source string, path string))

func ForEachScriptsDPath added in v0.3.1

func ForEachScriptsDPath(fn func(originalSource, expandedSource string))

func ForEachSourcedScript added in v0.3.0

func ForEachSourcedScript(input string, fn func(string))

func ForEachVariableAssignment added in v0.3.0

func ForEachVariableAssignment(key, input string, fn func(string))

Types

type CandidateSource added in v0.2.0

type CandidateSource interface {
	WhereSet(somePath string) *PathSetIn
}

func NewNixCandidateSource added in v0.2.0

func NewNixCandidateSource(fs Filesystem, key string) CandidateSource

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 Location added in v0.2.0

type Location struct {
	Original string
	Expanded string
}

type NixCandidateSource added in v0.2.0

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

func (*NixCandidateSource) WhereSet added in v0.2.0

func (s *NixCandidateSource) WhereSet(somePath string) *PathSetIn

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 PathSetIn added in v0.2.0

type PathSetIn struct {
	What     Location
	WhereSet []Location // file it's potentially set in
}

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"`
	CandidateSources []string `json:"candidate_sources,omitempty"`
}

type ResultsCalculator added in v0.2.0

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

func NewCustomResultsCalculator added in v0.2.0

func NewCustomResultsCalculator(fs Filesystem, source ValueSource, candidateSource CandidateSource) *ResultsCalculator

func NewResultsCalculator added in v0.2.0

func NewResultsCalculator(fs Filesystem, source ValueSource) *ResultsCalculator

func (*ResultsCalculator) CalculateResults added in v0.2.0

func (r *ResultsCalculator) CalculateResults() ([]ResultRow, error)

type ValueSource

type ValueSource interface {
	// Source is the name/key of the value
	Source() string
	// Orig is the original string value
	Orig() string
	// Values is the split list from original value
	Values() []string
}

Jump to

Keyboard shortcuts

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