option

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	VerifySHA256Digest bool `json:"verify-sha256" yaml:"verify-sha256" mapstructure:"verify-sha256"`
}

func (*Check) AddFlags

func (o *Check) AddFlags(flags clio.FlagSet)

type Cooldown added in v0.13.0

type Cooldown struct {
	IgnoreCooldown bool `json:"ignore-cooldown" yaml:"ignore-cooldown" mapstructure:"ignore-cooldown"`
}

func (*Cooldown) AddFlags added in v0.13.0

func (o *Cooldown) AddFlags(flags clio.FlagSet)

type Core added in v0.2.0

type Core struct {
	Store `json:"" yaml:",inline" mapstructure:",squash"`
	// CooldownRaw is the raw config value for the global cooldown duration.
	// Use Cooldown field after PostLoad has been called.
	CooldownRaw any          `json:"cooldown" yaml:"cooldown,omitempty" mapstructure:"cooldown"`
	Cooldown    JSONDuration `json:"-" yaml:"-" mapstructure:"-"`
	Tools       Tools        `json:"tools" yaml:"tools" mapstructure:"tools"`
}

Core options make up the static application configuration on disk.

func DefaultCore added in v0.2.0

func DefaultCore() Core

func (*Core) PostLoad added in v0.13.0

func (c *Core) PostLoad() error

PostLoad is called by fangs after config loading to parse raw config values.

type Format added in v0.7.0

type Format struct {
	Output           string   `yaml:"output" json:"output" mapstructure:"output"`
	AllowableFormats []string `yaml:"-" json:"-" mapstructure:"-"`
	JQCommand        string   `yaml:"jqCommand" json:"jqCommand" mapstructure:"jqCommand"`
}

func (*Format) AddFlags added in v0.7.0

func (o *Format) AddFlags(flags fangs.FlagSet)

type GoBuild added in v0.12.0

type GoBuild struct {
	Module     string   `json:"module" yaml:"module" mapstructure:"module"`
	Entrypoint string   `json:"entrypoint" yaml:"entrypoint" mapstructure:"entrypoint"`
	LDFlags    string   `json:"ld-flags" yaml:"ld-flags" mapstructure:"ld-flags"`
	Args       []string `json:"args" yaml:"args" mapstructure:"args"`
	Env        []string `json:"env" yaml:"env" mapstructure:"env"`
	Source     string   `json:"source" yaml:"source" mapstructure:"source"`
	RepoURL    string   `json:"repo-url" yaml:"repo-url" mapstructure:"repo-url"`
}

func (*GoBuild) AddFlags added in v0.12.0

func (o *GoBuild) AddFlags(flags clio.FlagSet)

type GoInstall added in v0.2.0

type GoInstall struct {
	Module     string   `json:"module" yaml:"module" mapstructure:"module"`
	Entrypoint string   `json:"entrypoint" yaml:"entrypoint" mapstructure:"entrypoint"`
	LDFlags    string   `json:"ld-flags" yaml:"ld-flags" mapstructure:"ld-flags"`
	Args       []string `json:"args" yaml:"args" mapstructure:"args"`
	Env        []string `json:"env" yaml:"env" mapstructure:"env"`
}

func (*GoInstall) AddFlags added in v0.2.0

func (o *GoInstall) AddFlags(flags clio.FlagSet)

type JSONDuration added in v0.13.0

type JSONDuration struct {
	Duration time.Duration
	IsSet    bool
}

JSONDuration is a time.Duration that supports YAML/JSON unmarshaling from human-friendly duration strings like "7d" (days) in addition to standard Go durations like "168h". The IsSet field tracks whether the value was explicitly configured (distinguishing "not configured" from "explicitly set to zero").

func (JSONDuration) MarshalText added in v0.13.0

func (d JSONDuration) MarshalText() ([]byte, error)

func (*JSONDuration) ParseFrom added in v0.13.0

func (d *JSONDuration) ParseFrom(v any) error

ParseFrom parses a JSONDuration from various input types that may come from config loading (string, int, float64, etc). This is needed because mapstructure doesn't support TextUnmarshaler interface, so we need to handle the raw config value in PostLoad.

func (*JSONDuration) UnmarshalText added in v0.13.0

func (d *JSONDuration) UnmarshalText(text []byte) error

func (*JSONDuration) UnmarshalYAML added in v0.13.0

func (d *JSONDuration) UnmarshalYAML(unmarshal func(interface{}) error) error

type List added in v0.5.0

type List struct {
	Updates       bool     `json:"updates" yaml:"updates" mapstructure:"updates"`
	IncludeFilter []string `json:"includeFilter" yaml:"includeFilter" mapstructure:"includeFilter"`
}

func (*List) AddFlags added in v0.5.0

func (o *List) AddFlags(flags clio.FlagSet)

type Store

type Store struct {
	Root string `json:"root" yaml:"root" mapstructure:"root"`
}

func DefaultStore

func DefaultStore() Store

type Tool

type Tool struct {
	Name    string            `json:"name" yaml:"name" mapstructure:"name"`
	Version ToolVersionConfig `json:"version" yaml:"version" mapstructure:"version"`

	InstallMethod string         `json:"method" yaml:"method,omitempty" mapstructure:"method"`
	Parameters    map[string]any `json:"with" yaml:"with,omitempty" mapstructure:"with"`
}

func (Tool) ToConfig

func (t Tool) ToConfig(opts ToolOptions) (*tool.Config, *binny.VersionIntent, error)

func (Tool) ToTool

func (t Tool) ToTool(opts ToolOptions) (binny.Tool, *binny.VersionIntent, error)

type ToolOptions added in v0.13.0

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

ToolOptions holds configuration for tool construction behavior.

func DefaultToolOptions added in v0.13.0

func DefaultToolOptions() ToolOptions

DefaultToolOptions returns a ToolOptions with default values.

func (ToolOptions) WithGlobalCooldown added in v0.13.0

func (o ToolOptions) WithGlobalCooldown(d JSONDuration) ToolOptions

WithGlobalCooldown sets the global cooldown that applies to all tools (unless overridden per-tool).

func (ToolOptions) WithIgnoreCooldown added in v0.13.0

func (o ToolOptions) WithIgnoreCooldown(ignore bool) ToolOptions

WithIgnoreCooldown sets whether all cooldowns should be bypassed.

type ToolVersionConfig

type ToolVersionConfig struct {
	Want       string `json:"want" yaml:"want" mapstructure:"want"`
	Constraint string `json:"constraint" yaml:"constraint,omitempty" mapstructure:"constraint"`
	// CooldownRaw is the raw config value for the per-tool cooldown duration.
	// Use Cooldown field after PostLoad has been called.
	CooldownRaw   any          `json:"cooldown" yaml:"cooldown,omitempty" mapstructure:"cooldown"`
	Cooldown      JSONDuration `json:"-" yaml:"-" mapstructure:"-"`
	ResolveMethod string       `json:"method" yaml:"method,omitempty" mapstructure:"method"`

	Parameters map[string]any `json:"with" yaml:"with,omitempty" mapstructure:"with"`
}

func (*ToolVersionConfig) PostLoad added in v0.13.0

func (t *ToolVersionConfig) PostLoad() error

PostLoad is called by fangs after config loading to parse raw config values.

type Tools

type Tools []Tool

func (Tools) GetAllOptions

func (t Tools) GetAllOptions(names []string) ([]Tool, error)

func (Tools) GetOption

func (t Tools) GetOption(name string) *Tool

func (Tools) Names

func (t Tools) Names() []string

type VersionResolution added in v0.2.0

type VersionResolution struct {
	Constraint string `json:"constraint" yaml:"constraint" mapstructure:"constraint"`
	Method     string `json:"method" yaml:"method" mapstructure:"method"`
}

func (*VersionResolution) AddFlags added in v0.2.0

func (o *VersionResolution) AddFlags(flags clio.FlagSet)

Jump to

Keyboard shortcuts

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