From 20642ab16177b3acf99f1cfe3df4e38ba1f8385a Mon Sep 17 00:00:00 2001 From: codex-binaural Date: Fri, 20 Jun 2025 12:18:32 -0400 Subject: [PATCH] Use pip3 for Python formatter --- scripts/python-format.sh | 17 +++++++++++++++++ scripts/xml-format.sh | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 scripts/python-format.sh create mode 100755 scripts/xml-format.sh 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 {} \; +