Documentation
¶
Index ¶
- func ParseAndRun(ctx context.Context, cmd cmds.Command, parseOptions []ParseOption, ...) error
- func ParseCommandParameters(cmd cmds.Command, options ...ParseOption) (*layers.ParsedLayers, error)
- func RunCommand(ctx context.Context, cmd cmds.Command, parsedLayers *layers.ParsedLayers, ...) error
- type ParseOption
- type ParseOptions
- type RunOption
- type RunOptions
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 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
}
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 ¶
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