runner

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAndRun

func ParseAndRun(
	ctx context.Context,
	cmd cmds.Command,
	parseOptions []ParseOption,
	runOptions []RunOption,
) error

ParseAndRun combines parameter parsing and command execution into a single function

func ParseCommandParameters

func ParseCommandParameters(
	cmd cmds.Command,
	options ...ParseOption,
) (*layers.ParsedLayers, error)

ParseCommandParameters parses parameters for a command using a configurable middleware chain

func RunCommand

func RunCommand(
	ctx context.Context,
	cmd cmds.Command,
	parsedLayers *layers.ParsedLayers,
	options ...RunOption,
) error

RunCommand executes a Glazed command with the given parsed parameters and options

Types

type ParseOption

type ParseOption func(*ParseOptions)

func WithAdditionalMiddlewares

func WithAdditionalMiddlewares(middlewares ...cmd_middlewares.Middleware) ParseOption

WithAdditionalMiddlewares adds custom middlewares to the parsing chain

func WithConfigFiles added in v0.7.0

func WithConfigFiles(files ...string) ParseOption

WithConfigFiles applies a list of config files (low -> high precedence)

func WithEnvMiddleware

func WithEnvMiddleware(prefix string) ParseOption

WithEnvMiddleware enables environment variable parsing with the given prefix

func WithEnvPrefix

func WithEnvPrefix(prefix string) ParseOption

WithEnvPrefix sets the prefix for environment variable parsing

func WithValuesForLayers

func WithValuesForLayers(values map[string]map[string]interface{}) ParseOption

WithValuesForLayers sets values for parameters in specified layers

func WithViper

func WithViper() ParseOption

WithViper enables loading parameters from Viper configuration

type ParseOptions

type ParseOptions struct {
	ValuesForLayers       map[string]map[string]interface{}
	EnvPrefix             string
	AdditionalMiddlewares []cmd_middlewares.Middleware
	UseViper              bool
	UseEnv                bool
	ConfigFiles           []string
}

ParseOptions contains configuration for parameter parsing

type RunOption

type RunOption func(*RunOptions)

func WithGlazeProcessor

func WithGlazeProcessor(p middlewares.Processor) RunOption

WithGlazeProcessor sets the processor to use for GlazeCommand output

func WithWriter

func WithWriter(w io.Writer) RunOption

WithWriter sets the writer to use for WriterCommand output

type RunOptions

type RunOptions struct {
	Writer         io.Writer
	GlazeProcessor middlewares.Processor
}

RunOptions contains configuration for running a command

Jump to

Keyboard shortcuts

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