mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
pull each parser as a json object into a bash array and iterate on it to add supplementary information like version, author, and compatibility
This commit is contained in:
26
docgen.sh
26
docgen.sh
@ -11,10 +11,26 @@ pydocmd simple utils+ > ../docs/utils.md
|
|||||||
# a bit of inception here... jc is being used to help
|
# a bit of inception here... jc is being used to help
|
||||||
# automate the generation of its own documentation. :)
|
# automate the generation of its own documentation. :)
|
||||||
|
|
||||||
parsers=$(jc -a | jq -r .parsers[].name)
|
# pull jc parser objects into a bash array from jq
|
||||||
|
parsers=()
|
||||||
for parser in $parsers
|
while read -r value
|
||||||
do
|
do
|
||||||
echo Building docs for: $parser
|
parsers+=("$value")
|
||||||
pydocmd simple jc.parsers.${parser}+ > ../docs/parsers/${parser}.md
|
done < <(jc -a | jq -c '.parsers[]')
|
||||||
|
|
||||||
|
# iterate over the bash array
|
||||||
|
for parser in "${parsers[@]}"
|
||||||
|
do
|
||||||
|
# pydocmd simple jc.parsers.${parser}+ > ../docs/parsers/${parser}.md
|
||||||
|
parser_name=$(echo -e "$parser" | jq -r '.name' )
|
||||||
|
compatible=$(echo -e "$parser" | jq -r '.compatible | join(", ")')
|
||||||
|
version=$(echo -e "$parser" | jq -r '.version')
|
||||||
|
author=$(echo -e "$parser" | jq -r '.author')
|
||||||
|
author_email=$(echo -e "$parser" | jq -r '.author_email')
|
||||||
|
|
||||||
|
echo "Building docs for: ${parser_name}"
|
||||||
|
pydocmd simple jc.parsers."${parser_name}"+ > ../docs/parsers/"${parser_name}".md
|
||||||
|
echo "Compatibility: ${compatible}" >> ../docs/parsers/"${parser_name}".md
|
||||||
|
echo >> ../docs/parsers/"${parser_name}".md
|
||||||
|
echo "Version ${version} by ${author} (${author_email})" >> ../docs/parsers/"${parser_name}".md
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user