All Projects → tmc → tmpl

tmc / tmpl

Licence: ISC license
tmpl - unix-friendly templating tool.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Labels

Projects that are alternatives of or similar to tmpl

sftp-gateway
This repository contains a docker image configured to use the SSH File Transfer Protocol (SFTP) to transfer all its files to Cloud Blob Storage Services. This image can be deployed on a Kubernetes cluster with Helm.
Stars: ✭ 18 (-5.26%)
Mutual labels:  helm
lldbg
A lightweight native GUI for LLDB.
Stars: ✭ 83 (+336.84%)
Mutual labels:  unix
redislabs-helm
Helm charts for Redis Enterprise
Stars: ✭ 12 (-36.84%)
Mutual labels:  helm
helm-github-pages
Publish your Kubernetes Helm Charts on GitHub Pages. DEPRECATED: please use https://github.com/helm/chart-releaser
Stars: ✭ 22 (+15.79%)
Mutual labels:  helm
whichpm
Locates installed Perl modules.
Stars: ✭ 20 (+5.26%)
Mutual labels:  unix
quickhist
quickly plot a histogram on the CLI
Stars: ✭ 45 (+136.84%)
Mutual labels:  unix
dotfiles
My awesomewm dotfiles for awesome people! ✨
Stars: ✭ 1,764 (+9184.21%)
Mutual labels:  unix
inspr
Inspr is an agnostic application mesh for simpler, faster, and securer development of distributed applications (dApps).
Stars: ✭ 49 (+157.89%)
Mutual labels:  helm
smartcd
Expedite your navigation of Linux filesystem.
Stars: ✭ 35 (+84.21%)
Mutual labels:  unix
kernel
Main kernel tree
Stars: ✭ 28 (+47.37%)
Mutual labels:  unix
georgios
Hobby Operating System
Stars: ✭ 19 (+0%)
Mutual labels:  unix
helm-github
A Helm plugin to install raw Helm Charts from Github
Stars: ✭ 54 (+184.21%)
Mutual labels:  helm
helm-gitignore
Helm interface for generating .gitignore files
Stars: ✭ 20 (+5.26%)
Mutual labels:  helm
kubernetes-is
Kubernetes and Helm resources for WSO2 Identity Server
Stars: ✭ 23 (+21.05%)
Mutual labels:  helm
gitops-playground
Reproducible infrastructure to showcase GitOps workflows and evaluate different GitOps Operators on Kubernetes
Stars: ✭ 77 (+305.26%)
Mutual labels:  helm
helm-lobste.rs
An Helm front-end for Lobste.rs
Stars: ✭ 20 (+5.26%)
Mutual labels:  helm
Book k8sInfra
< 컨테이너 인프라 환경 구축을 위한 쿠버네티스/도커 >
Stars: ✭ 176 (+826.32%)
Mutual labels:  helm
mediasoup-broadcast-example
Mediasoup WebRTC vanilla JS broadcast example.
Stars: ✭ 107 (+463.16%)
Mutual labels:  helm
aero
Aero is a new modern, experimental, unix-like operating system following the monolithic kernel design. Supporting modern PC features such as long mode, 5-level paging, and SMP (multicore), to name a few.
Stars: ✭ 407 (+2042.11%)
Mutual labels:  unix
emqx-chart
emqx kubernetes helm
Stars: ✭ 18 (-5.26%)
Mutual labels:  helm

tmpl

Command tmpl renders a template with the current env vars as input.

tmpl packs a punch in under 200 lines of code: a single static binary supplies the capabilities of many more complicated templating engines.

It's especially helpful as an early entrypoint into containers to prepare configuration files.

$ tmpl -h
Usage of tmpl:
  -f string
    	Input source (default "-")
  -html
    	If true, use html/template instead of text/template
  -r string
    	If provided, traverse the argument as a directory
  -stripn int
    	If provided, strips this many directories from the output (only valid if -r and -w are provided)
  -w string
    	Output destination (default "-")

It effectively exposes Go's text/template for use in shells.

Reference text/template documentation for template language specification.

It includes all of the template helpers from sprig.

Safe Dockerfile Inclusion

To safely include in your build pipelines:

FROM ubuntu:bionic

RUN apt-get update
RUN apt-get install -y curl

ARG TMPL_URL=https://github.com/tmc/tmpl/releases/download/v1.9/tmpl_linux_amd64
ARG TMPL_SHA256SUM=6064853353391b947ccdbf5584dcfdf5d0ab448ef9631dc48e296a53095b32f9
RUN curl -fsSLo tmpl ${TMPL_URL} \
		&& echo "${TMPL_SHA256SUM}  tmpl" | sha256sum -c - \
		&& chmod +x tmpl && mv tmpl /usr/local/bin/tmpl

Safe Shell Scripting Inclusion

To safely include in your shell scripts:

#!/bin/bash
set -euo pipefail

# Helper Functions
case "${OSTYPE}" in
linux*) platform=linux
	;;
darwin*)
	platform=darwin
	;;
*) platform=unknown ;;
esac

function install_tmpl() {
  if [[ "${platform}" == "darwin" ]]; then
    TMPL_SHA256SUM=1e4cae660f2a28d66187df9a1549cd71e1e19397a92edd6cef946d62102b2794
  else
    TMPL_SHA256SUM=6064853353391b947ccdbf5584dcfdf5d0ab448ef9631dc48e296a53095b32f9
  fi
  TMPL_URL=https://github.com/tmc/tmpl/releases/download/v1.9/tmpl_${platform}_amd64
  curl -fsSLo tmpl ${TMPL_URL} \
    && echo "${TMPL_SHA256SUM}  tmpl" | sha256sum -c - \
    && chmod +x tmpl
  mv tmpl /usr/local/bin/tmpl || echo "could not move tmpl into place"
}

command -v tmpl > /dev/null || install_tmpl

Example 1

Given a file 'a' with contents:

{{ range $key, $value := . }}
  KEY:{{ $key }} VALUE:{{ $value }}
{{ end }}

Invoking

$ cat a | env -i ANSWER=42 ITEM=Towel `which tmpl`

Produces

KEY:ANSWER VALUE:42

KEY:ITEM VALUE:Towel

Example 2

Given a file 'b' with contents:

VERSION={{.HEAD}}

Invoking

$ cat b | HEAD="$(git rev-parse HEAD)" tmpl

Produces

VERSION=4dce1b0a03b59b5d63c876143e9a9a0605855748

Example 3

Given a directory via the -r flag, tmpl recurses, expanding each path and file and produces a tarball to the output destination.

Invoking

$ mkdir testdata/recursive-out
$ tmpl -r testdata/recursive-example | tar -C testdata/recursive-out --strip-components=2 -xvf -
$ cat testdata/recursive-out/user-tmc

Produces (for me, at time of writing)

For the current user tmc:
Shell: /bin/bash
EDITOR: vim
😎
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].