From 24358e2588f465e2bba9a719d1bce86339125cb5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Jul 2026 09:42:46 +0000 Subject: [PATCH] Add --cmake option and .cmake file support to strip_c_comments_safe.sh --- strip_c_comments_safe.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/strip_c_comments_safe.sh b/strip_c_comments_safe.sh index 3af5836e0..f1b5e5238 100755 --- a/strip_c_comments_safe.sh +++ b/strip_c_comments_safe.sh @@ -6,6 +6,7 @@ DRY_RUN=0 WITH_CPP=0 WITH_BASH=0 WITH_PYTHON=0 +WITH_CMAKE=0 TARGET_DIR="." usage() { @@ -19,6 +20,7 @@ Optionen: --cpp Zusätzlich auch C++-Dateien verarbeiten --bash Zusätzlich auch Bash-Skripte (*.sh) verarbeiten --python Zusätzlich auch Python-Skripte (*.py) verarbeiten + --cmake Zusätzlich auch CMake-Skripte (*.cmake) verarbeiten -h, --help Hilfe anzeigen Argumente: @@ -31,6 +33,7 @@ Beispiele: ./strip_c_comments_safe.sh --cpp src ./strip_c_comments_safe.sh --bash scripts ./strip_c_comments_safe.sh --python tools + ./strip_c_comments_safe.sh --cmake cmake ./strip_c_comments_safe.sh --cpp --backup-ext .orig ./project EOF } @@ -61,6 +64,10 @@ while [[ $# -gt 0 ]]; do WITH_PYTHON=1 shift ;; + --cmake) + WITH_CMAKE=1 + shift + ;; -h|--help) usage exit 0 @@ -397,6 +404,9 @@ detect_mode() { *.py) echo "python" ;; + *.cmake) + echo "bash" + ;; *) echo "" ;; @@ -418,6 +428,10 @@ if [[ "$WITH_PYTHON" -eq 1 ]]; then find_expr+=( -o -name "*.py" ) fi +if [[ "$WITH_CMAKE" -eq 1 ]]; then + find_expr+=( -o -name "*.cmake" ) +fi + find "$TARGET_DIR" -type f \( "${find_expr[@]}" \) -print0 | while IFS= read -r -d '' file; do mode="$(detect_mode "$file")"