codegen

package
v0.0.0-...-6c5d6b1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const RootDir = ".forge"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name    string   `yaml:"name"`
	Prompts []Prompt `yaml:"prompts"`
	InOuts  []InOut  `yaml:"mappings"`
}

Config is the configuration for generating code.

type Data

type Data map[string]string

type Generator

type Generator struct {
	Config Config
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(name string) (Generator, error)

NewGenerator returns a new Generator. It finds the codegen configuration file by name and marshals it into the Config struct.

func (*Generator) BuildData

func (g *Generator) BuildData(data Data)

BuildData builds the data for the template execution.

func (*Generator) Generate

func (g *Generator) Generate() error

Generate generates the files by the template execution.

func (*Generator) ParseInOuts

func (g *Generator) ParseInOuts() error

ParseInOuts parses the input and output paths by the template execution.

type InOut

type InOut struct {
	Input  string `yaml:"input"`
	Output string `yaml:"output"`
}

InOut is a mapping of input to output.

type Prompt

type Prompt struct {
	Name    string `yaml:"name"`
	Message string `yaml:"message"`
}

Prompt is a prompt for the user to enter.

Jump to

Keyboard shortcuts

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