mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-05 16:35:23 +00:00
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# This script generates API documentation templates.
|
|
# Usage:
|
|
#
|
|
# ./generate-templates file
|
|
#
|
|
# File is expected to have a list of commands, one per line.
|
|
# The templates will be created in api/ directory.
|
|
|
|
if (( $# != 1 )); then
|
|
echo "Usage: ./generate-templates file"
|
|
echo
|
|
echo "File specifies a plain text file with each line having name of a command"
|
|
exit
|
|
fi
|
|
|
|
|
|
mkdir -p api/
|
|
|
|
while read -r CMD; do
|
|
F=api/$CMD.json
|
|
|
|
if [ -e $F ]; then
|
|
echo "$F exists, skipping"
|
|
continue;
|
|
fi
|
|
echo "{" > $F
|
|
echo " \"name\": \"$CMD\"," >> $F
|
|
echo " \"brief\": \"a sentence or two explaining what this command does\"," >> $F
|
|
echo " \"description\": \"See <xref linkend=\\\"cmd-$LINE\\\"/>\"," >> $F
|
|
echo " \"support\": [ \"undocumented\" ]," >> $F
|
|
echo " \"avail\": \"0.0.0\"," >> $F
|
|
echo " \"hook\": \"undocumented\"," >> $F
|
|
|
|
echo " \"cmd-syntax\": \"Syntax of the command\"," >> $F
|
|
echo " \"cmd-comment\": \"Possibly some extra comments after the syntax.\"," >> $F
|
|
|
|
echo " \"resp-syntax\": \"Syntax of the response\"," >> $F
|
|
echo " \"resp-comment\": \"Optional extra comments after the resposne syntax.\"" >> $F
|
|
echo "}" >> $F
|
|
|
|
echo "$CMD generated."
|
|
done < $1
|