64 lines
1.1 KiB
Bash
64 lines
1.1 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
#
|
||
|
|
# extract service docs
|
||
|
|
|
||
|
|
FILES="src/main/java/com/sequencelogic/web/*/*.java"
|
||
|
|
|
||
|
|
for f in $FILES; do
|
||
|
|
echo
|
||
|
|
echo "SOURCE FILE: sli/$f"
|
||
|
|
cat $f | awk '
|
||
|
|
BEGIN {
|
||
|
|
basepath=""
|
||
|
|
prevleaf=""
|
||
|
|
desc=""
|
||
|
|
}
|
||
|
|
/@Path/ {
|
||
|
|
if (basepath == "") {
|
||
|
|
#printf "TOP @Path matched %s\n", $0
|
||
|
|
basepath = $0;
|
||
|
|
sub("@Path[(]", "", basepath);
|
||
|
|
sub("[)]", "", basepath);
|
||
|
|
gsub("\42", "", basepath);
|
||
|
|
sub("^[ \t]+", "", basepath);
|
||
|
|
} else {
|
||
|
|
leafpath = $0;
|
||
|
|
sub("@Path[(]", "", leafpath);
|
||
|
|
sub("[)]", "", leafpath);
|
||
|
|
gsub("\42", "", leafpath);
|
||
|
|
sub("^[ \t]+", "", leafpath);
|
||
|
|
desc = "";
|
||
|
|
}
|
||
|
|
next;
|
||
|
|
}
|
||
|
|
/@GET|@POST|@DELETE/ {
|
||
|
|
sub("^[ \t]+", "");
|
||
|
|
method = $0;
|
||
|
|
desc = "";
|
||
|
|
consumes = "";
|
||
|
|
produces = "";
|
||
|
|
next;
|
||
|
|
}
|
||
|
|
/@Consumes/ {
|
||
|
|
consumes = $0;
|
||
|
|
sub("^[ \t]+", "", consumes);
|
||
|
|
next;
|
||
|
|
}
|
||
|
|
/@Produces/ {
|
||
|
|
produces = $0;
|
||
|
|
sub("^[ \t]+", "", produces);
|
||
|
|
printf " %-10s /sli/v2/%s/%-32s -- %s %s\n %s\n", method, basepath, leafpath, produces, consumes, desc
|
||
|
|
next;
|
||
|
|
}
|
||
|
|
{
|
||
|
|
if (prevleaf != leafpath){
|
||
|
|
desc = $0;
|
||
|
|
sub("^[ \t/]+", "", desc);
|
||
|
|
prevleaf = leafpath;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
'
|
||
|
|
done
|
||
|
|
|
||
|
|
exit 0
|