spiff-arena/docs/bin/edit_all

34 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
# function to update single file
function update_file() {
local file="$1"
if [[ "$file" == "./Support/FAQ.md" ]]; then
echo "skipping $file since it is in a question and answer format that LLMs cannot handle. They assume you are doing few-shot learning and do not return the full doc."
return
fi
markdown_to_ventilated_prose.py "$file" "$file"
./bin/edit "$file"
markdown_to_ventilated_prose.py "$file" "$file"
}
while IFS= read -r -d '' file; do
update_file "$file"
done < <(find . -type f -name "*.md" -print0)
# update_file "Support/Welcome_Messages.md"
# these are long, problematic files, good for testing.
# not sure why documentation.md likes to get lots of extra newlines added.
# echo 'fyi, running test files, not all files'
# for file in Getting_Started/quick_start.md Support/FAQ.md documentation/documentation.md; do
# update_file "$file"
# done