Kapow is a template processor that provides the following directives to support injecting file contents, command output, current date/time, etc in generated files.
Directive | Description
---|---
!inc:path
| Include file contents; path is relative to its containing file
!run:command
| Run command and insert stdout
Directive | Example | Description
---|---|---
`!now`
| 2023-03-11T14:29:19Z | Current date/time in UTC / RFC 3339
`!now:local`
| Sat 11 Mar 2023 09:29:19 EST | Current date/time in local timezone
`!now:local:%A %H:%M`
| Saturday 09:29 | Current date/time in local timezone and custom format
`!now:MST7MDT`
| Sat 11 Mar 2023 07:29:19 MST | Current date/time in custom timezone
`!now:MST7MDT:%A %H:%M`
| Saturday 07:29 | Current date/time in custom timezone and format
`!now:US/Hawaii`
| Sat 11 Mar 2023 04:29:19 HST | Current date/time in custom locale
`!now:US/Hawaii:%A %H:%M`
| Saturday 04:29 | Current date/time in custom locale and format
`!now:UTC:%A %H:%M`
| Saturday 14:29 | Current date/time in UTC and custom format
`!now:x`
| Xh2AETJ | Current date/time in "x" format
`!today`
| 2023-03-11 | Current date in UTC / RFC 3339
`!today:local`
| 2023-03-11 | Current date in local timezone
`!today:MST7MDT`
| 2023-03-11 | Current date in custom timezone
`!today:MST7MDT:%v`
| 11-Mar-2023 | Current date in custom timezone and format
`!today:US/Hawaii`
| 2023-03-11 | Current date in custom locale
`!today:US/Hawaii:%x`
| 03/11/23 | Current date in custom locale and format
`!today:UTC:%A`
| Saturday | Current date in UTC and custom format
!
with a backslash: \!
.text
$ kapow -V
kapow 2.3.0
```text $ kapow -h KAPOW!
Usage: kapow [OPTIONS]
Arguments:
Options: -r, --readme Print readme -h, --help Print help -V, --version Print version ```
-r
option uses bat for paging and syntax highlighting if you
have it installed (optional).Code | Description ---|--- 101 | Could not read input file 102 | Could not read included file 103 | Could not change directory
See the readme
task in Makefile.toml
:
t/VERSION.md
from t/VERSION.t.md
!run:../target/release/kapow -V
t/USAGE.md
from t/USAGE.t.md
!run:../target/release/kapow -h
README.md
from t/README.md
!inc:VERSION.md
!inc:USAGE.md
`!now`
(all variants)!run:
output;
enable backslash-wrapping long commands;
include whitespace in included files;
process path of included files relative to the containing file instead of the current directory;
input and included file processed more efficiently via BufReader
instead of read_to_string
;
improved error handlingbat -pl md
as readme pager if have it installed; update dependencies!today
span directive; improved exit macro; change directory function;
where clauses; fix watch task; fix readmebash
cargo install bat cargo-edit cargo-make cargo-outdated dtg kapow \
miniserve