make-lsp: Fix quoting on -C and -f, JSON dir fix

This commit is contained in:
Andrew Rogers 2023-10-09 03:02:49 -05:00
commit c56fc66966

View file

@ -24,7 +24,7 @@ OPTIONS
EOU EOU
MAKEFILE='' MAKEFILE=''
MAKEDIR='' MAKEDIR='.'
DEBUG=0 DEBUG=0
while getopts 'hdC:f:' opt; do while getopts 'hdC:f:' opt; do
@ -36,10 +36,10 @@ while getopts 'hdC:f:' opt; do
DEBUG=1 DEBUG=1
;; ;;
C) C)
MAKEDIR="-C'$OPTARG'" MAKEDIR="$OPTARG"
;; ;;
f) f)
MAKEFILE="--file='$OPTARG'" MAKEFILE="--file=$OPTARG"
;; ;;
esac esac
done done
@ -50,7 +50,7 @@ COMPILER_RX='^\s*cc|^\s*cxx|^\s*c\+\+|^\s*gcc|^\s*g\+\+|^\s*clang|^\s*clang\+\+'
[ "$DEBUG" -ne 0 ] && set -x [ "$DEBUG" -ne 0 ] && set -x
make "$MAKEDIR" "$MAKEFILE" --always-make --dry-run ${@} \ make "-C$MAKEDIR" "$MAKEFILE" --always-make --dry-run ${@} \
| grep -E "$COMPILER_RX" \ | grep -E "$COMPILER_RX" \
| grep -w '\-c' \ | grep -w '\-c' \
| jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$").string[1:]}]' | jq -nR '[inputs|{directory:"'"$MAKEDIR"'", command:., file: match(" [^ ]+$").string[1:]}]'