Skip over navigation

BogBat

A bog-basic template replacement program.

Version 0.1.0
Released 2025-06-05
O/S Windows 7 SP1 & later

Overview

BogBat is a simple 64 bit Windows command line program that takes a text file containing templates and a data file as input and generates an output file with each template replaced by data value defined in the data file.

This program is very simple. It just replaces templates with text values. There are no loops, no functions, no text processing and no intelligent handling of white space around templates. The program's simple nature led to the name: the Bog Basic template program.

Basic usage

The following command line shows the normal way to use BogBat.

BogBat -d:data-file -t:template-file -o:output-file

This causes BogBat to read a data file named data-file and a template file named template-file and to output a file named output-file that results from replacing any templates in template-file with data from data-file.

You must provide a data file on the command line, but if either the template file or output file is not present then the template text is read from standard input and the output is sent to standard output. Of course, either standard input or standard output can be redirected so:

BogBat -d:data-file <template-file >output-file

works exactly the same as the previous example.

File formats

The data file must have entries of the form key=value, with each entry on a different line. Blank lines and lines that begin with a # character are ignored. Spaces before key and between key and = are ignored. Spaces after the = sign are significant and are included in value.

Template files are simple text files that contain templates. By default templates are delimited by {{ and }} symbol pairs. Any text inside the delimiters is taken to be one of the key values in the data file. The whole template is replaced by the value from the data file that corresponds to key. For example, if we have a template file with content:

The {{ foo }} sat on the {{ bar }}.

And data file with content:

foo=cat
bar=mat

Then running BogBat with the two files above produces the output:

The cat sat on the mat.

If any Key has no value after the = sign, or if the key referenced in a template does not exist then the template is deleted from the output.

By default all input files are assumed to be in UTF-8 format (either with or without UTF-8 preambles) and the output file is written in UTF-8 without a preamble. The text file encodings and use of preambles can be overridden using command line options.

The {{ and }} characters used to delimit templates can be altered using a command line option. This is useful since there is no method of including the opening delimiter literally in the output so changing to a different delimter that doesn't appear literally in the text is the only way round this.

Getting help

All the available command line options can be displayed using the command:

BogBat --help

The output from this file is comprehensive and will scroll out of the console window. The output is sent to standard error, so can't be paged by the more command. You can however send the output to a text file using the following command:

BogBat --help 2>my-file.txt

Copyright and license

BogBat is copyright © 2025 by Peter Johnson. The program and its source code are released under the terms of the MIT License.

Download

This program is hosted on GitHub in the ddabapps/bogbat repository. The program can be downloaded from the repository's Releases tab.

Each release gives the option of downloading either the program's executable code or the source code. Your options are:

  • Choose bogbat-exe-0.1.0.zip to download a zip file containing the program. It is named BogBat.exe. There is no installer. Just extract the program's .exe file from the .zip file and copy it to a folder on your system or on an external drive. It can be run from there.
  • Choose Source code.zip to download the source code in .zip format.
  • Choose Source code.tar.gz to download the source code as a g-zipped tarball.

At present BogBat is only available as a 64 bit program. If there is any demand for a 32 bit version that may be considered for a future release. To request a 32 bit version you'll need to raise an issue.

Get v0.1.0 from GitHub

Documentation

The following documentation is available. All of it opens on GitHub.

Bugs & Feature Requests

You can report bugs or suggest new features using the BogBat issue tracker on GitHub.

Please review existing bug reports and feature requests before creating a new issue. If an issue already exists you may be able to help by adding a further comment.

You will need a GitHub account if you want to create or edit an issue.