refactor
This commit is contained in:
@@ -38,9 +38,13 @@ else
|
||||
fi
|
||||
|
||||
NVIM_REQUIRED_BINARIES=(
|
||||
clang-tidy
|
||||
cmake
|
||||
cppcheck
|
||||
cppman
|
||||
curl
|
||||
dart
|
||||
eslint
|
||||
flutter
|
||||
fzf
|
||||
g++
|
||||
@@ -48,6 +52,7 @@ NVIM_REQUIRED_BINARIES=(
|
||||
git
|
||||
go
|
||||
java
|
||||
luafmt
|
||||
make
|
||||
node
|
||||
npm
|
||||
@@ -61,6 +66,8 @@ NVIM_REQUIRED_BINARIES=(
|
||||
tidy
|
||||
tree-sitter
|
||||
unzip
|
||||
vala-language-server
|
||||
valac
|
||||
wget
|
||||
zip
|
||||
)
|
||||
@@ -91,10 +98,8 @@ function check_binary() {
|
||||
|
||||
function ensure_brew_binary() {
|
||||
if ! command -v "$1" >/dev/null 2>&1; then
|
||||
check_binary brew
|
||||
brew install "$2"
|
||||
fi
|
||||
check_binary "$1"
|
||||
}
|
||||
|
||||
function ensure_brew_keg_binary() {
|
||||
@@ -104,42 +109,37 @@ function ensure_brew_keg_binary() {
|
||||
return
|
||||
fi
|
||||
|
||||
check_binary brew
|
||||
formula_prefix=$(brew --prefix "$2")
|
||||
if [ ! -x "${formula_prefix}/bin/$1" ]; then
|
||||
brew install "$2"
|
||||
fi
|
||||
export PATH="${formula_prefix}/bin:${PATH}"
|
||||
check_binary "$1"
|
||||
}
|
||||
|
||||
export PATH="${HOME}/.local/bin:${PATH}"
|
||||
|
||||
for BINARY in "${NVIM_REQUIRED_BINARIES[@]}"; do
|
||||
check_binary "$BINARY"
|
||||
done
|
||||
|
||||
if ! command -v eslint >/dev/null 2>&1; then
|
||||
npm install --global --prefix "${HOME}/.local" eslint
|
||||
fi
|
||||
check_binary eslint
|
||||
|
||||
if ! command -v luafmt >/dev/null 2>&1; then
|
||||
npm install --global --prefix "${HOME}/.local" lua-fmt
|
||||
fi
|
||||
check_binary luafmt
|
||||
|
||||
if [ "${NVIM_OS}" = "macOS" ]; then
|
||||
check_binary brew
|
||||
ensure_brew_binary cppcheck cppcheck
|
||||
ensure_brew_binary cppman cppman
|
||||
ensure_brew_binary pwsh powershell
|
||||
ensure_brew_binary vala-language-server vala-language-server
|
||||
ensure_brew_keg_binary clang-tidy llvm
|
||||
|
||||
check_binary pwsh
|
||||
fi
|
||||
check_binary clang-tidy
|
||||
check_binary cppcheck
|
||||
check_binary cppman
|
||||
check_binary valac
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user