| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (C) 2025 Phosh.mobi e.V. |
| 4 | # |
| 5 | # SPDX-License-Identifier: GPL-3.0-or-later |
| 6 | # |
| 7 | # Author: Gotam Gorabh <[email protected]> |
| 8 | # |
| 9 | # Scans specified source directories for 'gchar' usage. |
| 10 | # |
| 11 | # Usage: |
| 12 | # ./g-style src tests plugins |
| 13 | # If no directories are provided, the whole repository is scanned. |
| 14 | |
| 15 | set -e |
| 16 | |
| 17 | # Use command-line arguments if given; if none, scan the whole tree |
| 18 | SOURCE_DIRS=("$@") |
| 19 | |
| 20 | status=0 |
| 21 | |
| 22 | # Search for gchar |
| 23 | if git grep -q "\bgchar\b" -- "${SOURCE_DIRS[@]}"; then |
| 24 | echo "Found 'gchar' in these files:" |
| 25 | git grep -nH "\bgchar\b" -- "${SOURCE_DIRS[@]}" |
| 26 | |
| 27 | echo |
| 28 | echo "gchar usage detected. Please use 'char' over 'gchar'." |
| 29 | status=1 |
| 30 | fi |
| 31 | |
| 32 | exit $status |