mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +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
|
||||
# automate the generation of its own documentation. :)
|
||||
|
||||
parsers=$(jc -a | jq -r .parsers[].name)
|
||||
|
||||
for parser in $parsers
|
||||
# pull jc parser objects into a bash array from jq
|
||||
parsers=()
|
||||
while read -r value
|
||||
do
|
||||
echo Building docs for: $parser
|
||||
pydocmd simple jc.parsers.${parser}+ > ../docs/parsers/${parser}.md
|
||||
parsers+=("$value")
|
||||
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
|
||||
|
Reference in New Issue
Block a user