-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.md.tmpl
More file actions
102 lines (70 loc) · 2.51 KB
/
README.md.tmpl
File metadata and controls
102 lines (70 loc) · 2.51 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Usages
## Without input object
```
$ text-template-cli example1.txt.tmpl
{{ stdout "text-template-cli" "example1.txt.tmpl" -}}
```
An environment variable `USER` is used to render.
## Use redirection to output to a file
```
$ text-template-cli example1.txt.tmpl dummy.env >output.txt
{{ shell "text-template-cli example1.txt.tmpl dummy.env >output.txt" -}}
```
```
$ cat output.txt
{{ stdout "cat" "output.txt" -}}
```
## .env file
```
$ text-template-cli example1.txt.tmpl dummy.env
{{ stdout "text-template-cli" "example1.txt.tmpl" "dummy.env" -}}
```
## JSON file
```
$ text-template-cli example1.txt.tmpl dummy.json
{{ stdout "text-template-cli" "example1.txt.tmpl" "dummy.json" -}}
```
## YAML file
```
$ text-template-cli example1.txt.tmpl dummy.yaml
{{ stdout "text-template-cli" "example1.txt.tmpl" "dummy.yaml" -}}
```
## Multiple input files
```
$ text-template-cli example1.txt.tmpl dummy.env dummy.json
{{ combinedout "text-template-cli" "example1.txt.tmpl" "dummy.env" "dummy.json" -}}
```
```
$ text-template-cli example1.txt.tmpl dummy.env dummy.json dummy.yaml
{{ combinedout "text-template-cli" "example1.txt.tmpl" "dummy.env" "dummy.json" "dummy.yaml" -}}
```
## Suppress warning messages
Use redirection for stderr to /dev/null or somewhere.
```
$ text-template-cli example1.txt.tmpl dummy.env dummy.json dummy.yaml 2>/dev/null
{{ stdout "text-template-cli" "example1.txt.tmpl" "dummy.env" "dummy.json" "dummy.yaml" -}}
```
## Sprig functions
Use functions `default`, `contains`, `lower` and `ternary` from [sprig](https://masterminds.github.io/sprig/).
```
$ text-template-cli sprig.tmpl dummy.env
{{ stdout "text-template-cli" "sprig.tmpl" "dummy.env" -}}
```
```
$ text-template-cli sprig.tmpl dummy.json
{{ stdout "text-template-cli" "sprig.tmpl" "dummy.json" -}}
```
## Directory
```
$ TITLE=Example1 text-template-cli dir-example1/source --output-directory dir-example1/output
```
This command will render all files in the directory dir-example1/source and output to the directory dir-example1/output.
## File with output directory
```
$ TITLE=Example2 text-template-cli dir-example1/source/dir1/README.md.tmpl --output-directory dir-example1/output
```
This command will render the file dir-example1/source/dir1/README.md.tmpl and output to the file dir-example1/output/README.md.
```
text-template-cli dir-example1/source/dir2/simple1.txt --output-directory dir-example1/output
```
This command will copy the file dir-example1/source/dir2/simple1.txt and output to the file dir-example1/output/simple1.txt.