command_dir

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandDirHandler

type CommandDirHandler struct {
	DevMode bool

	// TemplateName is the name of the template that is lookup up through the given TemplateLookup
	// used to render the glazed command.
	TemplateName string
	// IndexTemplateName is the name of the template that is looked up through TemplateLookup to render
	// command indexes. Leave empty to not render index pages at all.
	IndexTemplateName string
	// TemplateLookup is used to look up both TemplateName and IndexTemplateName
	TemplateLookup render.TemplateLookup

	// Repository is the command repository that is exposed over HTTP through this handler.
	Repository *repositories.Repository

	// AdditionalData is passed to the template being rendered.
	AdditionalData map[string]interface{}

	ParameterFilter *config.ParameterFilter

	// If true, all glazed outputs will try to use a row output if possible.
	// This means that "ragged" objects (where columns might not all be present)
	// will have missing columns, only the fields of the first object will be used
	// as rows.
	//
	// This is true per default, and needs to be explicitly set to false to use
	// a normal TableMiddleware oriented output.
	Stream bool
}

func NewCommandDirHandlerFromConfig

func NewCommandDirHandlerFromConfig(
	config_ *config.CommandDir,
	options ...CommandDirHandlerOption,
) (*CommandDirHandler, error)

func (*CommandDirHandler) Serve

func (cd *CommandDirHandler) Serve(server *parka.Server, path string) error

type CommandDirHandlerOption

type CommandDirHandlerOption func(handler *CommandDirHandler)

func WithDefaultIndexTemplateName

func WithDefaultIndexTemplateName(name string) CommandDirHandlerOption

func WithDefaultTemplateName

func WithDefaultTemplateName(name string) CommandDirHandlerOption

func WithDevMode

func WithDevMode(devMode bool) CommandDirHandlerOption

handling all the ways to configure overrides

func WithIndexTemplateName

func WithIndexTemplateName(name string) CommandDirHandlerOption

func WithMergeAdditionalData added in v0.3.2

func WithMergeAdditionalData(data map[string]interface{}, override bool) CommandDirHandlerOption

WithMergeAdditionalData merges the passed in map with the handler's AdditionalData map. If a value is already set in the AdditionalData map and override is true, it will get overwritten.

func WithParameterFilter added in v0.5.0

func WithParameterFilter(overridesAndDefaults *config.ParameterFilter) CommandDirHandlerOption

func WithParameterFilterOptions added in v0.5.0

func WithParameterFilterOptions(opts ...config.ParameterFilterOption) CommandDirHandlerOption

func WithTemplateLookup

func WithTemplateLookup(lookup render.TemplateLookup) CommandDirHandlerOption

func WithTemplateName

func WithTemplateName(name string) CommandDirHandlerOption

Jump to

Keyboard shortcuts

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