-
Notifications
You must be signed in to change notification settings - Fork 2
/
docgen
executable file
·46 lines (37 loc) · 1.04 KB
/
docgen
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
#!/bin/bash
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function parse()
{
full_path=$1
dir_name=$(dirname ${full_path})
echo "<a href=\"./${dir_name}/\">${dir_name}</a>" >> ${dir}/index.html
while IFS= read line; do
if [[ $line = '//*'* ]]; then
if [[ $line = '//*desc:'* ]]; then
echo ${line:9} >> ${dir}/index.html
else
echo " " ${line:3} >> ${dir}/index.html
fi
fi
done <"${full_path}"
echo "" >> ${dir}/index.html
}
function section()
{
name=$1
name_lower=$(echo "${name}" | tr '[:upper:]' '[:lower:]')
echo "<pre><h4>${name}</h4><ul>" >> ${dir}/index.html
cd ${dir}/${name_lower}
files=($(find . -name *.php))
cd ${dir}
for fn in "${files[@]}"; do
file="${name_lower}/${fn:2:${#fn}}"
parse ${file}
done
echo "</ul></pre>" >> ${dir}/index.html
}
echo "<pre><h3>NERVA Public API</h3></pre>" > ${dir}/index.html
section Daemon
section Wallet
section External
section Analytics