diff --git a/common.sh b/common.sh index 7fe2f1b..56434b2 100755 --- a/common.sh +++ b/common.sh @@ -37,6 +37,26 @@ else NVIM_OS="linux" fi +NVIM_REQUIRED_BINARIES=( + cmake + curl + fz + g++ + gcc + git + make + node + npm + rg + rsync + sed + shfmt + tar + unzip + wget + zip +) + function create_link() { local cur local res @@ -55,6 +75,16 @@ function error_exit() { exit 1 } +function check_binary() { + if command -v "$1" >/dev/null 2>&1; then + error_exit "failed to find required binary: $1" + fi +} + +for BINARY in "${NVIM_REQUIRED_BINARIES[@]}"; do + check_binary "$BINARY" +done + pushd "${SCRIPT_DIR}" 1>/dev/null 2>&1 || error_exit "failed to push: ${SCRIPT_DIR}" FNAME=cpptools-${NVIM_OS}-${NVIM_ARCH2}.vsix if [ ! -f "dap/${FNAME}" ]; then @@ -93,5 +123,6 @@ popd 1>/dev/null 2>&1 || error_exit "failed to popd: ${SCRIPT_DIR}" export NVIM_ARCH export NVIM_ARCH2 export NVIM_CPPTOOLS_VERSION -export NVIM_VERSION export NVIM_OS +export NVIM_REQUIRED_BINARIES +export NVIM_VERSION