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