About

Kapow is a template processor that provides the following directives to support injecting file contents, command output, current date/time, etc in generated files.

Block directives

Directive | Description ---|--- !inc:path | Include file contents; path is relative to its containing file !run:command | Run command and insert stdout

Span directives

Directive | Example | Description ---|---|--- `!now` | 2023-03-13T17:31:59Z | Current date/time in UTC / RFC 3339 `!now:local` | Mon 13 Mar 2023 13:31:59 EDT | Current date/time in local timezone `!now:local:%A %H:%M` | Monday 13:31 | Current date/time in local timezone and custom format `!now:MST7MDT` | Mon 13 Mar 2023 11:31:59 MDT | Current date/time in custom timezone `!now:MST7MDT:%A %H:%M` | Monday 11:31 | Current date/time in custom timezone and format `!now:US/Hawaii` | Mon 13 Mar 2023 07:31:59 HST | Current date/time in custom locale `!now:US/Hawaii:%A %H:%M` | Monday 07:31 | Current date/time in custom locale and format `!now:UTC:%A %H:%M` | Monday 17:31 | Current date/time in UTC and custom format `!now:x` | Xh2CHVx | Current date/time in "x" format `!today` | 2023-03-13 | Current date in UTC / RFC 3339 `!today:local` | 2023-03-13 | Current date in local timezone `!today:MST7MDT` | 2023-03-13 | Current date in custom timezone `!today:MST7MDT:%v` | 13-Mar-2023 | Current date in custom timezone and format `!today:US/Hawaii` | 2023-03-13 | Current date in custom locale `!today:US/Hawaii:%x` | 03/13/23 | Current date in custom locale and format `!today:UTC:%A` | Monday | Current date in UTC and custom format

Usage

text $ kapow -V kapow 2.4.0

```text $ kapow -h KAPOW!

Usage: kapow [OPTIONS] [INPUT_FILES]...

Arguments: [INPUT_FILES]... Input file(s) [default: -]

Options: -r, --readme Print readme -h, --help Print help -V, --version Print version ```

Errors

Code | Description ---|--- 101 | Could not read input file 102 | Could not read included file 103 | Could not change directory

Example

See the readme task in Makefile.toml:

Changelog

Development

bash cargo install bat cargo-edit cargo-make cargo-outdated dtg kapow \ miniserve