erplibre/script/maintenance/prettier_xml.sh
Mathieu Benoit aac73b57dd [FIX] script prettier_xml: force print_width to maximum
- Some XML string broke when formating, adding space in url by example
2022-10-04 23:22:41 -04:00

15 lines
576 B
Bash
Executable file

#!/usr/bin/env bash
# This will format all xml
# argument 1: directory or file to format
STR_ARG="'$*'"
if [[ "${STR_ARG}" = *"/data/"* ]]; then
# Need to keep width with data, else add corrupted string data
prettier --xml-whitespace-sensitivity "ignore" --prose-wrap always --tab-width 4 --no-bracket-spacing --print-width 999999999 --write $@
else
prettier --xml-whitespace-sensitivity "ignore" --prose-wrap always --tab-width 4 --no-bracket-spacing --print-width 120 --write $@
fi
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "Error prettier format"
exit 1
fi