Skip to content

Command Line

makolator has three sub-commands gen, inplace and clean:

usage: makolator [-h] {gen,inplace,clean} ...

Mako Templates (https://www.makotemplates.org/) extended.

positional arguments:
  {gen,inplace,clean}
    gen                Generate File
    inplace            Update File Inplace
    clean              Remove Fully-Generated Files

options:
  -h, --help           show this help message and exit

Generate

usage: makolator gen [-h] [--verbose] [--show-diff] [--tag_lines TAG_LINES]
                     [--stat]
                     [--existing {error,keep,overwrite,keep_timestamp}]
                     [--template-path TEMPLATE_PATH]
                     [--marker-fill MARKER_FILL]
                     [--marker-linelength MARKER_LINELENGTH] [--eol EOL]
                     [--exclude EXCLUDE] [--create]
                     templates [templates ...] output

positional arguments:
  templates             Template Files. At least one must exist
  output                Output File

options:
  -h, --help            show this help message and exit
  --verbose, -v         Tell what happens to the file.
  --show-diff, -s       Show what lines changed.
  --tag_lines TAG_LINES
                        Number of Inspected Lines on 'clean'. Default is 50.
  --stat, -S            Print Statistics
  --existing {error,keep,overwrite,keep_timestamp}, -e {error,keep,overwrite,keep_timestamp}
                        What if the file exists. Default is 'keep_timestamp'
  --template-path TEMPLATE_PATH, -T TEMPLATE_PATH
                        Directories with templates referred by include/inherit/...
  --marker-fill MARKER_FILL
                        Static Code, Inplace and Template Marker are filled with this given value until reaching line length of --marker-linelength.
  --marker-linelength MARKER_LINELENGTH
                        Static Code, Inplace and Template Marker are filled until --marker-linelength.
  --eol EOL, -E EOL     EOL comment on generated lines
  --exclude EXCLUDE, -x EXCLUDE
                        Exclude Pattern For Recursive Directory Generation
  --create, -c          Create Missing Inplace File

Generate a file from a template:

    makolator gen test.txt.mako test.txt

Generate a file from a template and fallback to 'default.txt.mako' if 'test.txt.mako' is missing:

    makolator gen test.txt.mako default.txt.mako test.txt

Inplace

usage: makolator inplace [-h] [--ignore-unknown] [--verbose] [--show-diff]
                         [--tag_lines TAG_LINES] [--stat]
                         [--existing {error,keep,overwrite,keep_timestamp}]
                         [--template-path TEMPLATE_PATH]
                         [--marker-fill MARKER_FILL]
                         [--marker-linelength MARKER_LINELENGTH] [--eol EOL]
                         [--exclude EXCLUDE] [--create]
                         [templates ...] inplace

positional arguments:
  templates             Optional Template Files
  inplace               Updated File

options:
  -h, --help            show this help message and exit
  --ignore-unknown, -i  Ignore unknown template function calls.
  --verbose, -v         Tell what happens to the file.
  --show-diff, -s       Show what lines changed.
  --tag_lines TAG_LINES
                        Number of Inspected Lines on 'clean'. Default is 50.
  --stat, -S            Print Statistics
  --existing {error,keep,overwrite,keep_timestamp}, -e {error,keep,overwrite,keep_timestamp}
                        What if the file exists. Default is 'keep_timestamp'
  --template-path TEMPLATE_PATH, -T TEMPLATE_PATH
                        Directories with templates referred by include/inherit/...
  --marker-fill MARKER_FILL
                        Static Code, Inplace and Template Marker are filled with this given value until reaching line length of --marker-linelength.
  --marker-linelength MARKER_LINELENGTH
                        Static Code, Inplace and Template Marker are filled until --marker-linelength.
  --eol EOL, -E EOL     EOL comment on generated lines
  --exclude EXCLUDE, -x EXCLUDE
                        Exclude Pattern For Recursive Directory Generation
  --create, -c          Create Missing Inplace File

Update with inplace template only:

    makolator inplace test.txt

Update a file from a template:

    makolator inplace test.txt.mako test.txt

Update a file from a template and fallback to 'default.txt.mako' if 'test.txt.mako' is missing:

    makolator inplace test.txt.mako default.txt.mako test.txt

Clean

usage: makolator clean [-h] [--verbose] [--show-diff] [--tag_lines TAG_LINES]
                       [--stat]
                       paths [paths ...]

positional arguments:
  paths                 Paths to look for files.

options:
  -h, --help            show this help message and exit
  --verbose, -v         Tell what happens to the file.
  --show-diff, -s       Show what lines changed.
  --tag_lines TAG_LINES
                        Number of Inspected Lines on 'clean'. Default is 50.
  --stat, -S            Print Statistics

Remove all files with '@fully-generated' in header.
The number of inspected lines at the top of a file is defined by --tag_lines.

    makolator clean .