diff --git a/scripts/python-format.sh b/scripts/python-format.sh new file mode 100755 index 00000000..1e30723b --- /dev/null +++ b/scripts/python-format.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Format Python files in the given directory using black. +# Usage: python-format.sh + +set -e + +TARGET_DIR="${1:-.}" + +# Install black if not available +if ! command -v black >/dev/null 2>&1; then + echo "black not found. Installing via pip3..." >&2 + pip3 install black +fi + +cd "$TARGET_DIR" +black ./ + diff --git a/scripts/xml-format.sh b/scripts/xml-format.sh new file mode 100755 index 00000000..9a6a588d --- /dev/null +++ b/scripts/xml-format.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Format XML files in the given directory using xmllint. +# Usage: xml-format.sh + +set -e + +TARGET_DIR="${1:-.}" + +# Install xmllint if not available +if ! command -v xmllint >/dev/null 2>&1; then + echo "xmllint not found. Installing libxml2-utils..." >&2 + apt-get update && apt-get install -y libxml2-utils +fi + +cd "$TARGET_DIR" +find . -type f -name "*.xml" -exec xmllint --format {} --output {} \; +