generators

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultManager = NewGeneratorManager()

DefaultManager is the default instance of the generator manager

Functions

This section is empty.

Types

type CommonGenerator

type CommonGenerator struct {
	Flagset *flagset.Flagset
}

func NewGenerator

func NewGenerator(flagset *flagset.Flagset, UnsupportedFlagTypes map[flagset.FlagType]bool) *CommonGenerator

NewGenerator creates a new generator

func (*CommonGenerator) GenerateFile

func (g *CommonGenerator) GenerateFile(customFunc template.FuncMap, tmpl string, params *Params[any], name string) error

type GeneratorCreator

type GeneratorCreator func() *cobra.Command

GeneratorCreator is a function that creates a generator command

type GeneratorInfo

type GeneratorInfo struct {
	Name        string
	Description string
	Stability   Stability
	Creator     GeneratorCreator
}

GeneratorInfo contains metadata about a generator

type GeneratorManager

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

GeneratorManager maintains a registry of available generators

func NewGeneratorManager

func NewGeneratorManager() *GeneratorManager

NewGeneratorManager creates a new generator manager

func (*GeneratorManager) GetAll

func (m *GeneratorManager) GetAll() map[string]GeneratorInfo

GetAll returns all registered generators

func (*GeneratorManager) GetCommands

func (m *GeneratorManager) GetCommands() []*cobra.Command

GetCommands returns cobra commands for all registered generators

func (*GeneratorManager) PrintGeneratorsTable

func (m *GeneratorManager) PrintGeneratorsTable() error

PrintGeneratorsTable prints a table of all available generators with their stability

func (*GeneratorManager) Register

func (m *GeneratorManager) Register(cmdCreator func() *cobra.Command)

Register adds a generator to the registry

type Params

type Params[T any] struct {
	OutputPath string
	Custom     T
}

type Stability

type Stability string

Represents the stability level of a generator

const (
	Alpha  Stability = "alpha"
	Beta   Stability = "beta"
	Stable Stability = "stable"
)

type TemplateData

type TemplateData struct {
	CommonGenerator
	Params[any]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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