diff --git a/.github/workflows/.gitattributes b/.github/workflows/.gitattributes new file mode 100644 index 0000000..b7bdc48 --- /dev/null +++ b/.github/workflows/.gitattributes @@ -0,0 +1 @@ +*.sh text eol=crlf diff --git a/.github/workflows/check-line-endings.yml b/.github/workflows/check-line-endings.yml new file mode 100644 index 0000000..47f8990 --- /dev/null +++ b/.github/workflows/check-line-endings.yml @@ -0,0 +1,46 @@ +name: Check Shell Script Line Endings + +on: + pull_request: + push: + +jobs: + check_crlf_in_sh: + name: Check for CRLF in .sh files + runs-on: ubuntu-latest + steps: + - name: Checkout code (with original line endings) + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Create .gitattributes to enforce LF + run: | + echo "*.sh text eol=lf" > .gitattributes + + - name: Check for CRLF in .sh files + shell: bash + run: | + echo "🔍 Scanning all *.sh files for CRLF endings..." + + mapfile -t all_sh_files < <(find . -type f -name "*.sh") + + bad_files=() + + for file in "${all_sh_files[@]}"; do + if grep -q $'\r' "$file"; then + bad_files+=("$file") + fi + done + + if (( ${#bad_files[@]} > 0 )); then + echo "🚫 Found ${#bad_files[@]} shell script(s) with CRLF endings:" + for f in "${bad_files[@]}"; do + echo " • $f" + done + echo "" + echo "💡 Convert them using: dos2unix or shellman line_endings --file --to lf" + exit 1 + else + echo "✅ All .sh files use proper LF endings." + fi diff --git a/VERSION b/VERSION index 100435b..ee94dd8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/commands/checksum_files.sh b/commands/checksum_files.sh index d9f9722..cf0ef02 100644 --- a/commands/checksum_files.sh +++ b/commands/checksum_files.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash # # Generate or verify checksums for many files. -# Default algo: sha256. Other supported: md5, sha1. +# Default algo: sha256. Other supported: md5, sha1. source ./lib/utils.sh show_help() { - echo "Usage:" + echo "Usage: " echo " shellman checksum_files [options]" echo "" echo "Description:" diff --git a/commands/clean_files.sh b/commands/clean_files.sh index 7de5a3b..e7bd3b6 100644 --- a/commands/clean_files.sh +++ b/commands/clean_files.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # Remove unwanted / temporary files from a tree. -# Supports dry‑run preview and age filter. +# Supports dry‑run preview and age filter. source ./lib/utils.sh