asmallteapot / dotfiles-old

Unix, in the key of @asmallteapot.
5 stars 0 forks source link

[system] port templates to jinja2 #5

Open asmallteapot opened 9 years ago

asmallteapot commented 9 years ago

Remove all ruby-related dependencies.

asmallteapot commented 8 years ago

An ideal solution would involve a generic command-line tool for generating text files based on a template and arbitrary input, with usage similar to this:

config.json

{ "email": "username@example.com" }

gitconfig.template

[user]
name={{environment.HUMAN}}
email={{email}}
[core]
editor={{environment.EDITOR}}
excludesfile={{environment.HOME}}/.gitignore

generate-gitconfig.sh

templatetool --template gitconfig.template --vars config.json --output gitconfig  --allow-environment-variables

Variables in the environment dictionary correspond to shell environment variables, and would only be present if the --allow-environment-variables flag is used.