mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 04:42:05 -04:00
tooling: make qmllint auto-resolution smarter
This commit is contained in:
@@ -27,7 +27,8 @@ quickshell -p quickshell/
|
||||
**Code formatting:**
|
||||
```bash
|
||||
qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml
|
||||
make lint-qml # Run from repo root; requires a generated quickshell/.qmlls.ini VFS from `qs -p quickshell/`
|
||||
make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`)
|
||||
# Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed.
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
@@ -10,11 +10,28 @@ repo_root="$(
|
||||
cd -- "${script_dir}/../.." && pwd
|
||||
)"
|
||||
quickshell_dir="${repo_root}/quickshell"
|
||||
qmllint_bin="${QMLLINT:-qmllint}"
|
||||
qmlls_config="${quickshell_dir}/.qmlls.ini"
|
||||
|
||||
if ! command -v -- "${qmllint_bin}" >/dev/null 2>&1; then
|
||||
printf 'error: qmllint not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2
|
||||
# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6
|
||||
# install path, and finally bare qmllint. We need the Qt 6 build (>= 6.x)
|
||||
# because older Qt 5 qmllint doesn't understand --ignore-settings / -W.
|
||||
resolve_qmllint() {
|
||||
if [[ -n "${QMLLINT:-}" ]]; then
|
||||
printf '%s\n' "${QMLLINT}"
|
||||
return
|
||||
fi
|
||||
local candidate
|
||||
for candidate in qmllint6 /usr/lib/qt6/bin/qmllint qmllint; do
|
||||
if command -v -- "${candidate}" >/dev/null 2>&1; then
|
||||
printf '%s\n' "${candidate}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! qmllint_bin="$(resolve_qmllint)"; then
|
||||
printf 'error: qmllint (Qt 6) not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2
|
||||
exit 127
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user