gotmpl

command
Version: v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: MIT Imports: 12 Imported by: 0

README

gotmpl

Command line tool for executing Go's templates. It templates a file with input data (JSON- or YAML-encoded) writing result to stdout.

Usage
USAGE:

	gotmpl TEMPLATE_FILE|- [DATA_FILE.json|DATA_FILE.yaml|-]


Example
$ cat >input.yaml <<EOF
> data:
>   value: "foo"
>   enabled: true
> EOF
$ cat >template.tmpl <<EOF
> {{- if .data.enabled }}
> The {{ .data.value }} feature is enabled.
> {{- else }}
> The {{ .data.value }} feature is disabled.
> {{- end }}
> EOF
 $ gotmpl template.tmpl input.yaml 
The foo feature is enabled.

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL