aboutsummaryrefslogtreecommitdiff
path: root/make
blob: 3399f88826915f9018ba91e255c61b24f938b1e8 (plain)
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
#!/bin/sh -eu

Content() {
number=1
amount=${1:-100}

rm --recursive --force content/markdown
mkdir --parents content/markdown

while [ $number -le "$amount" ]; do
date=$(date --iso-8601=ns)
file="content/markdown/$number.md"
printf \
'+++
date = "%s"
lastmod = "%s"
+++

Post Number %s
' \
"$date" \
"$date" \
"$number" \
> "$file"
printf 'Writing.. %s\n' "$file"
number=$((number+1))
done
}

Hugo() {
  sh "$0" Config
  hugo --debug
  rm --force .hugo_build.lock
}

Config() {
  set -x
  yj -yj -i < config.yaml > config.json
  yj -yt -i < config.yaml > config.toml
}

Clean() {
  set -x
  rm --recursive --force public
}

Server() {
  caddy file-server --listen :1313 --root public
}

"$@"