touch with templates
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.4 KiB

.TH TMPL\-VERSION 1 "JUNE 2021" "Alessandro Mauri"
tmpl \- touch with templates
.SY tmpl
.OP \-hf
.OP \-c dir
.I filename
tmpl is a POSIX shell script that creates a new file, filling it withe the
content of an appropriate template found in the template directory.
.IP "\-c dir"
Override the default template folder with
.I dir
Prints help information
.IP \-f
Forces override when creating the file
The principle behind tmpl is similar to touch(1), tmpl creates a new file
.I filename
and fills it with an appropriate template or nothing if no template is
available. Templates are chosen when their name matches
.I filename
or when the extensions match.
The templates are searched in the following paths:
Subdirectories are not scanned
Templates must be regular files, other than that they can have any name and
any content.
A simple example, and the main reason this tool was made is to prefill C source
files with a main().
Inside a file called template.c in one of the above mentioned paths put:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
return 0;
Now when you run:
$ tmpl foo.c
A new file called foo.c will be created with the contents of template.c
Alessandro Mauri <>
.BR touch(1)