Go Library
It is possible to import pimp as a standalone Go library. The 3 examples below respectively show you how to print the git branches of a repository by:
rendering a template
executing a PimpScript
using the native
text/templatepackage along with the pimp template functions
1. Render templates
package main
import (
"os"
"github.com/aymericbeaumet/pimp"
)
func main() {
_ = pimp.RenderTemplate(os.Stdout, `Git branches in {{pwd}}:
{{- range GitBranches}}
- {{.}}
{{- end}}
`)
}2. Execute PimpScript
3. Use the pimp template functions with `text/template`
Last updated