aboutsummaryrefslogtreecommitdiff
path: root/src/tools/xref.sh
blob: b014dae6c5dc9011bf082aee2e8d9d0a3f6c566b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# cross-reference of the compiler's global state: who writes each global, who only reads it.
# a shell wrapper around src/tools/xref.js (node). run `src/tools/xref.sh --help` for the options.
# needs build/bin/zclsp (make): exact scoping comes from the language server's references.
set -e
here=$(cd "$(dirname "$0")" && pwd)
if ! command -v node >/dev/null 2>&1; then
    case "$1" in
        --help|-h)
            echo "usage: src/tools/xref.sh [--check|--update] [--server PATH] [--compiler-dir DIR] [--baseline FILE] [--out DIR] [--jobs N]"
            echo "(node is required to run it)"
            exit 0 ;;
    esac
    echo "xref: node is required" >&2
    exit 3
fi
exec node "$here/xref.js" "$@"