NAME
stouch - Simple template file creator
SYNOPSIS
stouch [options] file ...
DESCRIPTION
stouch (stock touch) is a simple program that can create files based on pre-existing template files.
By default, stouch determines the template to used based on each file's suffix.
Templates
A stouch template is a file/directory that stouch uses to generate new files. A stouch template must be located in a template directory, with a filename like suffix.template. suffix is the suffix of the file type that the template is templating for. If you don't want to name a template after the file type's suffix, you can name it something else and then just refer to it using the -T option.
stouch templates also support basic text substitution via the -p option. Text substitution is accomplished via substitution targets. A substitution target is a string consisting of alphanumeric characters or underscores contained in double curly braces.
{{this}} <-- example of a valid substitution target
If "this => Hello!"
is supplied to the -p
option, the line will be transformed into this:
Hello! <-- example of a valid substitution target
If a substitution target is not given any text to be replaced by via the -p
option, the target will be unmodified and appear as-is in the generated file.
stouch templates are not just limitted to plain files, they can also be used for directories. When a directory template is used, stouch will re-create the template's directory tree and perform any specified text substitutions on the files in the template directory.
OPTIONS
- -T template
-
Instead of determining the template to use from the outputted file's suffix, use template instead. template must be the name of the template with the .template suffix removed. When using this option with multiple output files, each file will use the template specified by
-T
. - -t dir
-
Specify the template directory to use. Defaults to the value of the
STOUCH_TEMPLATES
environment variable. stouch requires one of them to be specified. - -p param
-
Specify what text substitutions to make on templated files. param is a comma-seperated list of key-value pairs, the substitution target being the key and the text to substitute with being the value. Key-value pairs are seperated by a fat arrow (=>).
-p "targ1 => Replaces targ1, targ2 => Replaces targ2, targ3 => etc..."
- -q
-
Quiet mode. Silence informative messages from being printed.
- -h
-
Print stouch help message and exit.
- -v
-
Print stouch version/copyright info and exit.
ENVIRONMENT
- STOUCH_TEMPLATES
-
Path to stouch template directory. Must be set if the
-t
option is not used.
AUTHORS
Written by Samuel Young, samyoung12788@gmail.com.
COPYRIGHT
Copyright 2024, Samuel Young
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.