definitions

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Position       int    `yaml:"position"`
	Required       bool   `yaml:"required"`
	Validate       string `yaml:"validate,omitempty"`
	Flag           string `yaml:"flag,omitempty"`
	Suffix         string `yaml:"suffix,omitempty"`          // append user value with this prefix, e.g. "@" for pkg@version
	FixedSuffix    string `yaml:"fixed_suffix,omitempty"`    // always append this suffix, e.g. "@none" for go remove
	ExtractionOnly bool   `yaml:"extraction_only,omitempty"` // arg is only used for output extraction, not passed to command
}

type Command

type Command struct {
	Base          []string            `yaml:"base"`
	BaseOverrides map[string][]string `yaml:"base_overrides,omitempty"` // flag name -> replacement base
	Args          map[string]Arg      `yaml:"args,omitempty"`
	Flags         map[string]Flag     `yaml:"flags,omitempty"`
	DefaultFlags  []string            `yaml:"default_flags,omitempty"`
	ExitCodes     map[int]string      `yaml:"exit_codes,omitempty"`
	Then          []Command           `yaml:"then,omitempty"` // commands to run after this one
	Extract       *Extract            `yaml:"extract,omitempty"`
}

type Definition

type Definition struct {
	Name             string             `yaml:"name"`
	Ecosystem        string             `yaml:"ecosystem"`
	Binary           string             `yaml:"binary"`
	Version          string             `yaml:"version,omitempty"`
	Status           string             `yaml:"status,omitempty"`
	MinTested        string             `yaml:"min_tested,omitempty"`
	MaxTested        string             `yaml:"max_tested,omitempty"`
	Detection        Detection          `yaml:"detection"`
	VersionDetection VersionDetection   `yaml:"version_detection,omitempty"`
	Commands         map[string]Command `yaml:"commands"`
	Capabilities     []string           `yaml:"capabilities"`
}

func LoadEmbedded

func LoadEmbedded() ([]*Definition, error)

func LoadFromBytes

func LoadFromBytes(data []byte) (*Definition, error)

type Detection

type Detection struct {
	Lockfiles  []string    `yaml:"lockfiles,omitempty"`
	Manifests  []string    `yaml:"manifests,omitempty"`
	Priority   int         `yaml:"priority"`
	FileChecks []FileCheck `yaml:"file_checks,omitempty"`
}

type Extract added in v0.4.0

type Extract struct {
	Type          string `yaml:"type"`                     // raw, json, line_prefix, regex, json_array, template
	Field         string `yaml:"field,omitempty"`          // for json: field name to extract
	Prefix        string `yaml:"prefix,omitempty"`         // for line_prefix: prefix to match
	Pattern       string `yaml:"pattern,omitempty"`        // for regex: pattern with capture group; for template: path pattern with {package}
	ArrayField    string `yaml:"array_field,omitempty"`    // for json_array: array field to search
	MatchField    string `yaml:"match_field,omitempty"`    // for json_array: field to match against pkg name
	ExtractField  string `yaml:"extract_field,omitempty"`  // for json_array: field to extract from matched element
	StripFilename bool   `yaml:"strip_filename,omitempty"` // remove filename from path, returning directory
}

type FileCheck

type FileCheck struct {
	File    string `yaml:"file"`
	Exists  bool   `yaml:"exists,omitempty"`
	Match   string `yaml:"match,omitempty"`
	Version string `yaml:"version,omitempty"`
}

type Flag

type Flag struct {
	Values []FlagValue
}

func (*Flag) UnmarshalYAML

func (f *Flag) UnmarshalYAML(unmarshal func(interface{}) error) error

type FlagValue

type FlagValue struct {
	Literal string
	Field   string
	Join    string // if set, join literal and field value with this (e.g., "=" for --flag=value)
}

type Validator

type Validator struct {
	Pattern   string `yaml:"pattern"`
	MaxLength int    `yaml:"max_length,omitempty"`
}

type VersionDetection

type VersionDetection struct {
	Command []string `yaml:"command,omitempty"`
	Pattern string   `yaml:"pattern,omitempty"`
}

Jump to

Keyboard shortcuts

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