nanoxd / templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

templates

Template files used to generate things. Uses the {{varname}} syntax for interpolation. Each project has a manifest.json file the metadata for that template.

Usage

This templates directory is meant to be sourced through a shell script. It's a neat little way of multiplexing arbitrary initialization commands. Here's a basic version you can place in your /usr/bin directory (or equivalent):

#!/bin/sh

if [ ! -z "$TEMPLATES" ]; then
  printf 'bin/ew: TEMPLATES variable not set\n'
  exit 1
fi

if [ $# = "0" ]; then
  printf 'usage: ew <template_name>\n'
  exit 1
fi

template="$TEMPLATES/$1/main"
if [ ! -x "$template" ]; then
  printf 'bin/ew: template %s does not exist\n' "$1"
  exit 1
fi

shift
"$template" "$@"

You can now run commands using ew, for example:

$ ew shell my_cool_shell_script

License

MIT

About

License:Other


Languages

Language:Shell 93.3%Language:JavaScript 2.6%Language:Makefile 2.5%Language:Rust 1.2%Language:Dockerfile 0.5%