-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md.hms
69 lines (48 loc) · 1.53 KB
/
README.md.hms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--- context ---
desc: cargo metadata --format-version=1 --no-deps | jq -r .packages[0].description
usage: cargo run --quiet -- --help | sed 's/\s*$//'
example:
hello:
src: cat examples/hello.hms
out: cargo run --quiet -- examples/hello.hms
context: cat examples/hello/context
template: cat examples/hello/template
cargo:
src: cat examples/cargo.hms
out: cargo run --quiet -- examples/cargo.hms
--- template ---
# Handlematters
{{desc}}
## Introduction
Handlematters is a template system that combines Handlebars and shell scripts. It is intended to replace simple substitution tasks such as those done by envsubst.
Here is an example of a Handlematters template:
```
{{{example.hello.src}}}
```
Passing this file to handlematters will result in the following output:
```
$ handlematters hello.hms
{{{example.hello.out}}}
```
Let's take a closer look.
```
{{{example.hello.context}}}
```
The `context` block is a YAML document. Each value of the property will be executed as a shell script and the output will be the resulting value.
```
{{{example.hello.template}}}
```
The `template` block is a Handlebars template. `\{{...}}` to output the context value. If you are not familiar with Handlebars syntax, have a look at https://handlebarsjs.com/.
Let's look at a more practical example:
```
{{{example.cargo.src}}}
```
Will result in:
```
{{{example.cargo.out}}}
```
Of course, this README is also generated by Handlematters. See: https://github.com/ursm/handlematters/blob/main/README.md.hms
## Usage
```
{{{usage}}}
```