arguments

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 4 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 {
	Name        string
	Description string
	Required    bool
	Example     string
	Default     string
}

type CLIProvider

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

CLIProvider resolves arguments from command-line key=value pairs. It validates that all provided keys match known argument names.

func NewCLIProvider

func NewCLIProvider(cliArgs []string) (*CLIProvider, error)

func (*CLIProvider) Provide

func (p *CLIProvider) Provide(args []Arg) ([]ResolvedArg, error)

type ErrorProvider

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

ErrorProvider always returns an error. Useful for testing error handling.

func NewErrorProvider

func NewErrorProvider(err error) *ErrorProvider

func (*ErrorProvider) Provide

func (p *ErrorProvider) Provide(args []Arg) ([]ResolvedArg, error)

type InteractiveProvider

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

InteractiveProvider prompts the user for each argument via stdin/stdout.

func NewInteractiveProvider

func NewInteractiveProvider(in io.Reader, out io.Writer) *InteractiveProvider

func (*InteractiveProvider) Provide

func (p *InteractiveProvider) Provide(args []Arg) ([]ResolvedArg, error)

type MissingArgsError

type MissingArgsError []Arg

func (MissingArgsError) Error

func (e MissingArgsError) Error() string

type Provider

type Provider interface {
	Provide(args []Arg) ([]ResolvedArg, error)
}

type ResolvedArg

type ResolvedArg struct {
	Name  string
	Value string
}

type StaticProvider

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

StaticProvider returns a fixed set of resolved arguments. Useful for testing.

func NewStaticProvider

func NewStaticProvider(values ...ResolvedArg) *StaticProvider

func (*StaticProvider) Provide

func (p *StaticProvider) Provide(args []Arg) ([]ResolvedArg, error)

type StrictProviderChain

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

StrictProviderChain chains multiple providers and ensures all required arguments are resolved. It stops early once all required arguments are satisfied.

func NewStrictProviderChain

func NewStrictProviderChain(providers ...Provider) *StrictProviderChain

func (*StrictProviderChain) Provide

func (p *StrictProviderChain) Provide(args []Arg) ([]ResolvedArg, error)

Jump to

Keyboard shortcuts

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