mirror of
https://github.com/davidallendj/configurator.git
synced 2025-12-20 11:37:00 -07:00
Added example generator plugin
This commit is contained in:
parent
e92a883c89
commit
5845408d5d
1 changed files with 32 additions and 0 deletions
32
internal/generator/plugins/example/example.go
Normal file
32
internal/generator/plugins/example/example.go
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
configurator "github.com/OpenCHAMI/configurator/internal"
|
||||||
|
"github.com/OpenCHAMI/configurator/internal/generator"
|
||||||
|
"github.com/OpenCHAMI/configurator/internal/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Example struct {
|
||||||
|
Message string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Example) GetName() string {
|
||||||
|
return "example"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Example) GetVersion() string {
|
||||||
|
return util.GitCommit()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Example) GetDescription() string {
|
||||||
|
return fmt.Sprintf("Configurator generator plugin for '%s'.", g.GetName())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *Example) Generate(config *configurator.Config, opts ...util.Option) (generator.Files, error) {
|
||||||
|
g.Message = `
|
||||||
|
This is an example generator plugin. See the file in 'internal/generator/plugins/example/example.go' on
|
||||||
|
information about constructing plugins and plugin requirements.`
|
||||||
|
return generator.Files{"example": []byte(g.Message)}, nil
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue