late

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT

README

late - Simple generic templating GoDoc Go Report Card

late is a simple generic templating tool based on golangs text/template.

Use it to template arbitrary files with data in the form of JSON (later more formats).

Example

The template file: terraform.tmpl

{{- range .resources }}
resource "res-{{.name}}" {
    vpcid = "{{.vpcid}}"
}
{{- end}}

The data file: data.json (could be dynamically generated):

{
    "resources": [
        {
            "name": "mysubnet1",
            "vpcid": "vpc-123"
        },
        {
            "name": "mysubnet2",
            "vpcid": "vpc-456"
        }
    ]
}

Render the template file based on the input data:

$ cat data.json | late render -f terraform.tmpl
resource "res-mysubnet1" {
    vpcid = "vpc-123"
}
resource "res-mysubnet2" {
    vpcid = "vpc-456"
}

Contribution

Feel free to make a pull request. For bigger changes create a issue first to discuss about it.

License

See LICENSE file.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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