Skip to content

Commit

Permalink
Add error handling to replace logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ottolote committed Apr 25, 2024
1 parent 2566a73 commit 743da7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ if ! test -f "${mdOutFile}"; then
exit 1
fi

if [ -f "$replaceFilePath" ]; then
if [ ! -f "$replaceFilePath" ]; then
error '' "Unable to find replace file $replaceFilePath" 1
else
jq -r 'to_entries | map("\(.key)/\(.value|tostring)") | .[]' "$replaceFilePath" |
xargs -I {} sed -i 's/{}/g' "$mdOutFile"
fi
Expand Down

0 comments on commit 743da7f

Please sign in to comment.