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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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