File: prepare_api_doc.sh

package info (click to toggle)
rdiff-backup 2.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,640 kB
  • sloc: python: 24,129; javascript: 9,512; sh: 1,230; ansic: 580; makefile: 36
file content (42 lines) | stat: -rwxr-xr-x 1,162 bytes parent folder | download
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
#!/bin/bash
# this function gathers all calls going through the client/server connection.
# the result can only be used as a basis or validation for the actual API
# documentation, especially because it can't make the difference between
# internal and external methods.

if ! [ -n "$1" ]
then
	echo "Usage: $0 XYY" >&2
	exit 1
fi

API_FILE=docs/api/v${1}.md

echo -e "\n## Sources\n" > ${API_FILE}.src

echo -e "\n### Internal\n" >> ${API_FILE}.src

grep -ro -e 'conn\.[a-zA-Z0-9._]*' src | \
	awk -F:conn. '{print "* `" $2 "`"}' | sort -u >> ${API_FILE}.src

echo -e "\n### External\n" >> ${API_FILE}.src


echo -e "\n## Testing\n" > ${API_FILE}.testing

echo -e "\n### Internal\n" >> ${API_FILE}.testing
echo -e "\n### External\n" >> ${API_FILE}.testing

grep -ro -e 'conn\.[a-zA-Z0-9._]*' testing | \
	awk -F:conn. '{print "* `" $2 "`"}' | sort -u | \
	grep --fixed-strings --line-regexp --file ${API_FILE}.src \
		--invert-match >> ${API_FILE}.testing

echo -e "# rdiff-backup API description v${1}\n" > ${API_FILE}
echo -e "\n## Format\n" >> ${API_FILE}

cat ${API_FILE}.* >> ${API_FILE}

rm ${API_FILE}.*

echo "API description prepared at '${API_FILE}'."