Documentation ¶
Index ¶
- Variables
- func LoadCustomFunction(g Generator)
- func Marshal(envMap map[string]string) (string, error)
- func Parse(r io.Reader) (envMap map[string]string, err error)
- func ReadFile(filename string) (fileBytes []byte, filePath string, err error)
- func ReadMakefileENV(filenames ...string) (envMap map[string]string)
- func ReadPatch(tmplDir, tmpl string) ([]diffmatchpatch.Patch, error)
- func ReadTemplate(tmplDir, tmpl string) (fileBytes []byte, filePath string, err error)
- func Unmarshal(str string) (envMap map[string]string, err error)
- func Write(envMap map[string]string, filename string) error
- type Bindings
- type Config
- type Generator
- type LiquidGenerator
- type Patch
- type Template
- type TextGeneraotr
- type TextTemplate
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFileNotFound = errors.New("file not found")
Functions ¶
func LoadCustomFunction ¶
func LoadCustomFunction(g Generator)
func Marshal ¶
Marshal outputs the given environment as a dotenv-formatted environment file. Each line is in the format: KEY="VALUE" where VALUE is backslash-escaped.
func ReadFile ¶
ReadFile recursively reads a file for given path till user home directory and returns nearest file to given path given path must be relative to working directory
func ReadMakefileENV ¶
Read all env (with same file loading semantics as Load) but return values as a map rather than automatically writing values into env
func ReadTemplate ¶
Types ¶
type Bindings ¶
func (Bindings) LoadFromENV ¶
func (Bindings) LoadFromFile ¶
LoadFromFile load Makefile variables from Makefile and replace existing variables
type Config ¶
type Config struct { // OnceFiles only generate once when creating new project OnceFiles []string `yaml:"once_files"` // SoftFiles will be generate every time when using generate command SoftFiles []string `yaml:"soft_files"` // HardFiles will be generate every time when using generate command with --hard flag HardFiles []string `yaml:"hard_files"` // DefaultENVs is default environment variables when creating new project. // on existing project, Makefile variables will replace these variables. DefaultENVs map[string]any `yaml:"default_envs"` WasmFuncs []custom_func.Libs `yaml:"wasm_funcs"` // contains filtered or unexported fields }
Config represents the configuration
type Generator ¶
type Generator interface { // SetOptions sets template engine binding SetOptions(bindings map[string]any) // Register a new template file to template engine Register(tmplDir, tmplFilePath string) error RegisterFunc(funcName string, function any) // Generate all templates Generate() error }
func NewLiquidGenerator ¶
func NewLiquidGenerator() Generator
func NewTextGenerator ¶
func NewTextGenerator() Generator
type LiquidGenerator ¶
type LiquidGenerator struct {
// contains filtered or unexported fields
}
func (*LiquidGenerator) Generate ¶
func (l *LiquidGenerator) Generate() error
func (*LiquidGenerator) Register ¶
func (l *LiquidGenerator) Register(tmplDir, tmpl string) error
func (*LiquidGenerator) RegisterFunc ¶
func (l *LiquidGenerator) RegisterFunc(funcName string, function any)
func (*LiquidGenerator) SetOptions ¶
func (l *LiquidGenerator) SetOptions(bindings map[string]any)
type TextGeneraotr ¶
type TextGeneraotr struct {
// contains filtered or unexported fields
}
func (*TextGeneraotr) Generate ¶
func (l *TextGeneraotr) Generate() error
func (*TextGeneraotr) Register ¶
func (l *TextGeneraotr) Register(tmplDir, tmpl string) error
func (*TextGeneraotr) RegisterFunc ¶
func (l *TextGeneraotr) RegisterFunc(funcName string, function any)
func (*TextGeneraotr) SetOptions ¶
func (l *TextGeneraotr) SetOptions(bindings map[string]any)
type TextTemplate ¶
type TextTemplate struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.