Remove misc

This commit is contained in:
KK
2026-07-03 01:21:35 +02:00
parent f97402bfa4
commit 68f9136ba5

View File

@@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'USAGE'
Usage: query-api PREFIX [ROOT]
Search API by prefix. If PREFIX does not end with '_', '_' is appended.
Functions are matched as implementations only: lines/signatures ending with '{'.
Types are matched as complete typedef/struct/enum definitions.
Defines are matched from #define names with the same prefix.
Examples:
misc/query-api s8
misc/query-api sb8 src
misc/query-api type_info
USAGE
}
if [[ $# -lt 1 || "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
exit 0
fi
prefix="$1"
root="${2:-src}"
if [[ "$prefix" != *_ ]]; then
prefix="${prefix}_"
fi
rg -n -U -P "(?ms)^fn\b(?=[^{;]*\b\Q${prefix}\E\w*\s*\()[^{;]*\{\s*$|^#define\s+\Q${prefix}\E\w*\b[^\r\n]*(?:\\\\\R[^\r\n]*)*|^typedef\s+struct\s+(\Q${prefix}\E\w*)\s+\1;\Rstruct\s+\1\s*\{.*?^\};|^struct\s+\Q${prefix}\E\w*\s*\{.*?^\};|^typedef\s+\w+\s+\Q${prefix}\E\w*;\Renum\s*\{.*?^\};|^typedef\b[^;]*\b\Q${prefix}\E\w*\b[^;]*;" "$root"