forked from PlakarKorp/plakar.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-doc.sh
More file actions
executable file
·88 lines (66 loc) · 2.41 KB
/
Copy pathupdate-doc.sh
File metadata and controls
executable file
·88 lines (66 loc) · 2.41 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
#!/bin/sh
VERSION=main
if [ "$1" != "" ]; then
VERSION=$1
fi
tempfoo=`basename $0`
TMPDIR=`mktemp -d /tmp/${tempfoo}.XXXXXX` || exit 1
onexit() {
rm -rf "$TMPDIR"
exit 0
}
trap 'onexit' EXIT INT TERM
git clone --depth 1 https://github.com/PlakarKorp/plakar.git -b ${VERSION} ${TMPDIR}
echo
cd ${TMPDIR}
commit=`git log ${VERSION} | head -4 | grep ^commit | cut -d' ' -f2`
date=`git log ${VERSION} | head -4 | grep ^Date: | cut -d' ' -f2`
author=`git log ${VERSION} | head -4 | grep ^Author: | cut -d' ' -f2,3,4,5`
cd -
echo
rm -rf ./content/docs/${VERSION}/commands/*
echo "generating documentation for ${VERSION}"
mkdir -p ./content/docs/${VERSION}/commands/
TITLE=${VERSION}
if test ${VERSION} = "main" ; then
TITLE="developers branch"
fi
cat <<EOF > ./content/docs/${VERSION}/commands/_index.md
---
title: "Commands"
date: "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
weight: 3
chapter: false
pre: "<b>3. </b>"
sort: "title"
summary: "Reference for all Plakar commands. Browse detailed documentation for each command, including usage, options, and examples. Access help online or directly from your terminal."
---
Welcome to the Plakar commands reference! Here you'll find detailed documentation for every available command in Plakar.
You can browse the documentation here, or access it directly from your terminal using the \`plakar help\` command. This makes it easy to get help and usage information whether you're online or working locally.
Below, you'll find the full list of commands. Click any command to view its documentation.
{{%children description="true"%}}
EOF
SUBCMDDIR=subcommands
if ! test -d "${TMPDIR}/${SUBCMDDIR}"; then
SUBCMDDIR=cmd/plakar/subcommands
fi
mkdir "$TMPDIR/manpages"
find "$TMPDIR/$SUBCMDDIR" -iname \*.[1-9] -ls -exec ln {} "$TMPDIR/manpages/" \;
[ -f "$TMPDIR/plakar.1" ] && ln "$TMPDIR/plakar.1" "$TMPDIR/manpages/"
[ -f "$TMPDIR/plakar-query.7" ] && ln "$TMPDIR/plakar-query.7" "$TMPDIR/manpages/"
for man in "$TMPDIR/manpages/"*; do
name="${man%%.[1-9]}"
name="${name##*/}"
summary="$(grep -m1 ^\.Nd "$man" | sed 's/^.Nd //')"
echo "generating documentation for ${name}"
mkdir -p ./content/docs/${VERSION}/commands/${name}
dest="./content/docs/${VERSION}/commands/${name}/index.md"
cat <<EOF > $dest
---
date: "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
title: ${name##plakar-}
summary: "${summary}"
---
EOF
mandoc -I os=Plakar -Thtml -Ofragment,man=../%N/ "$man" >> $dest
done