Skip to content

kawaken/funi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

funi

funi is template renderer with json/yaml data.

Install

go get github.com/kawaken/funi/cmd/funi

Usage

A template is passed via argument.

$ echo '{"key":"value"}' | funi "key is {{.key}}"
key is value

Use template file.

$ echo "key is {{.key}}" > key.tmpl
$ echo '{"key":"value"}' | funi -t key.tmpl
key is value

Template

Template syntax is from text/template.
template - The Go Programming Language

funi can handle multple template files. Use -t option multiple. Template are combined as one template.

$ echo "key: {{.key}}" > key2.tmpl 
$ echo '{"key":"value"}' | ./funi -t key.tmpl -t key2.tmpl
key is value
key: value

Options

$ funi -h
Usage of funi:
  -f string
      data format 'json' or 'yaml' (default "json")
  -i string
      input file (default STDIN)
  -o string
      output file (default STDOUT)
  -t string
      template file path (required)

-t is required when command line argument is nothing.

About

funi is template renderer for command line.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages