.TH TMPL\-VERSION 1 "JUNE 2021" "Alessandro Mauri" .SH NAME tmpl \- touch with templates .SH SYNOPSIS .SY tmpl .OP \-hf .OP \-c dir .I filename .YS .SH DESCRIPTION .PP 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. .SH OPTIONS .IP "\-c dir" Override the default template folder with .I dir Prints help information .IP \-f Forces override when creating the file .SH USAGE .PP 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. .SH FILES .PP The templates are searched in the following paths: .EX $HOME/.config/tmpl $HOME/.tmpl .EE Subdirectories are not scanned .PP Templates must be regular files, other than that they can have any name and any content. .SH EXAMPLES .PP 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: .EX #include #include int main(int argc, char **argv) { (void)argc; (void)argv; return 0; } .EE .PP Now when you run: .EX $ tmpl foo.c .EE A new file called foo.c will be created with the contents of template.c .SH AUTHOR Alessandro Mauri .SH "SEE ALSO" .BR touch(1)