All Projects → VirtusLab → Render

VirtusLab / Render

Licence: apache-2.0
Universal data-driven template for generating textual output, as a static binary and a library

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Render

Word Wrap
Wrap words to a specified length.
Stars: ✭ 107 (-0.93%)
Mutual labels:  cli, text
Peep
The CLI text viewer tool that works like less command on small pane within the terminal window.
Stars: ✭ 139 (+28.7%)
Mutual labels:  cli, text
Eyo
🦔 CLI for restoring the letter «ё» (yo) in russian texts
Stars: ✭ 119 (+10.19%)
Mutual labels:  cli, text
Aeneas
aeneas is a Python/C library and a set of tools to automagically synchronize audio and text (aka forced alignment)
Stars: ✭ 1,942 (+1698.15%)
Mutual labels:  cli, text
chisel
A library to sculpt text on any device that you can handle pixels
Stars: ✭ 37 (-65.74%)
Mutual labels:  text, renderer
Replace In File
A simple utility to quickly replace contents in one or more files
Stars: ✭ 369 (+241.67%)
Mutual labels:  cli, text
Arkade
Open Source Kubernetes Marketplace
Stars: ✭ 2,343 (+2069.44%)
Mutual labels:  cli, helm
Devspace
DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
Stars: ✭ 2,559 (+2269.44%)
Mutual labels:  cli, helm
Git History
Quickly browse the history of a file from any git repository
Stars: ✭ 12,676 (+11637.04%)
Mutual labels:  cli, text
Landscaper
Deprecated. Takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster
Stars: ✭ 342 (+216.67%)
Mutual labels:  cli, helm
React Blessed
A react renderer for blessed.
Stars: ✭ 4,204 (+3792.59%)
Mutual labels:  cli, renderer
Ml Ai Experiments
All my experiments with AI and ML
Stars: ✭ 107 (-0.93%)
Mutual labels:  text
W2j Cli
JavaWeb CLI Framework,Simple and easy to use. 简单易用的Javaweb 命令行框架
Stars: ✭ 107 (-0.93%)
Mutual labels:  cli
Render
Go package for easily rendering JSON, XML, binary data, and HTML templates responses.
Stars: ✭ 1,562 (+1346.3%)
Mutual labels:  text
Wuzz
Interactive cli tool for HTTP inspection
Stars: ✭ 9,845 (+9015.74%)
Mutual labels:  cli
Spinner
Go (golang) package with 90 configurable terminal spinner/progress indicators.
Stars: ✭ 1,637 (+1415.74%)
Mutual labels:  cli
Cliflix
Watch anything instantaneously, just write its name.
Stars: ✭ 1,439 (+1232.41%)
Mutual labels:  cli
Html Minifier Terser
actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code
Stars: ✭ 106 (-1.85%)
Mutual labels:  cli
Kovid
A CLI to fetch and compare the 2019 coronavirus pandemic statistics. It also fetches historical data and attempts to draw histograms of it to visualise the rate of infections.
Stars: ✭ 107 (-0.93%)
Mutual labels:  cli
Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+37830.56%)
Mutual labels:  cli

render

Version Travis CI Github All Releases Go Report Card GoDoc

Universal data-driven templates for generating textual output. Can be used as a single static binary (no dependencies) or as a golang library.

Just some of the things to render:

  • configuration files
  • Infrastructure as Code files (e.g. CloudFormation templates)
  • Kubernetes manifests

The renderer extends go-template and Sprig functions.

If you are interested in one of the use cases, take a look at this blog post about Kubernetes resources rendering. Also see Helm compatibility.

Installation

Official binary releases

For binaries please visit the Releases Page.

The binaries are statically compiled and does not require any dependencies.

Usage

$ render --help
NAME:
   render - Universal file renderer

USAGE:
   render [global options] command [command options] [arguments...]

VERSION:
   v0.2.0-86eb03f

AUTHOR:
   VirtusLab

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug, -d                   run in debug mode
   --indir value                 the input directory, can't be used with --out
   --outdir value                the output directory, the same as --outdir if empty, can't be used with --in
   --in value                    the input template file, stdin if empty, can't be used with --outdir
   --out value                   the output file, stdout if empty, can't be used with --indir
   --config value                optional configuration YAML file, can be used multiple times
   --set value, --var value      additional parameters in key=value format, can be used multiple times
   --unsafe-ignore-missing-keys  do not fail on missing map key and print '<no value>' ('missingkey=invalid')
   --help, -h                    show help
   --version, -v                 print the version

Notes:

  • --in, --out take only files (not directories), --in will consume any file as long as it can be parsed
  • stdin and stdout can be used instead of --in and --out
  • --config accepts any YAML file, can be used multiple times, the values of the configs will be merged
  • --set, --var are the same (one is used in Helm, the other in Terraform), we provide both for convenience, any values set here will override values form configuration files

Command line

Example usage of render with stdin, stdout and --var:

$ echo "something {{ .value }}" | render --var "value=new"
something new

Example usage of render with --in, --out and --config:

$ echo "something {{ .value }}" > test.txt.tmpl
$ echo "value: new" > test.config.yaml
$ ./render --in test.txt.tmpl --out test.txt --config test.config.yaml
$ cat test.txt
something new

Also see a more advanced template example.

As a library

package example

import (
    "github.com/VirtusLab/render/renderer"
    "github.com/VirtusLab/render/renderer/parameters"
)

func CustomRender(template string, opts []string, params parameters.Parameters) (string, error) {
    return renderer.New(
    	renderer.WithOptions(opts...),
        renderer.WithParameters(params),
        renderer.WithSprigFunctions(),
        renderer.WithExtraFunctions(),
        renderer.WithCryptFunctions(),
    ).Render(template)
}

See also other functions.

Also see tests for more usage examples.

Notable standard and sprig functions

All syntax and functions:

Custom functions

  • render - calls the render from inside of the template, making the renderer recursive (also accepts an optional template parameters override)
  • toYaml - provides a configuration data structure fragment as a YAML format
  • fromYaml - marshalls YAML data to a data structure (supports multi-documents)
  • fromJson - marshalls JSON data to a data structure
  • jsonPath - provides data structure manipulation with JSONPath (kubectl dialect)
  • n - used with range to allow easy iteration over integers form the given start to end (inclusive)
  • gzip, ungzip - use gzip compression and extraction inside the templates, for best results use with b64enc and b64dec
  • readFile - reads a file from a path, relative paths are translated to absolute paths, based on root function or property
  • writeFile - writes a file to a path, relative paths are translated to absolute paths, based on root function or property
  • root - the root path, used for relative to absolute path translation in any file based operations; by default PWD is used

See also examples and a more detailed documentation.

Cloud KMS (AWS, Amazon, Google) based cryptography functions form crypt:

  • encryptAWS - encrypts data using AWS KMS, for best results use with gzip and b64enc
  • decryptAWS - decrypts data using AWS KMS, for best results use with ungzip and b64dec
  • encryptGCP - encrypts data using GCP KMS, for best results use with gzip and b64enc
  • decryptGCP - decrypts data using GCP KMS, for best results use with ungzip and b64dec
  • encryptAzure - encrypts data using Azure Key Vault, for best results use with gzip and b64enc
  • decryptAzure - decrypts data using Azure Key Vault, for best results use with ungzip and b64dec

Helm compatibility

As of now, there is a limited Helm 2 Chart compatibility, simple Charts will render just fine.

To mimic Helm behaviour regarding to missing keys use --unsafe-ignore-missing-keys option.

There is no plan to implement full compatibility with Helm, because of unnecessary complexity that would bring.

If you need full Helm compatilble rendering see: helm-nomagic.

Limitations and future work

Planned new features

  • .renderignore files #12

Operating system support

We provide cross-compiled binaries for most platforms, but is currently used mainly with linux/amd64.

Community & Contribution

There is a dedicated channel #render on virtuslab-oss.slack.com (Invite form)

Feel free to file issues or pull requests.

Before any big pull request please consult the maintainers to ensure a common direction.

Development

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

mkdir -p $GOPATH/src/github.com/VirtusLab
cd $GOPATH/src/github.com/VirtusLab/render
git clone [email protected]:VirtusLab/render.git
cd render

make all

The name

We believe in obvious names. It renders. It's a verb. It's render.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].