2021-10-04 13:42:41 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
|
|
echo "Usage:"
|
2021-10-19 14:57:38 -04:00
|
|
|
printf " - %s [server_name]: install specified server\n" "$0"
|
2021-10-04 13:42:41 -04:00
|
|
|
printf " - %s -lsp: install all lsp servers\n" "$0"
|
|
|
|
printf " - %s -dap: install all dap servers\n" "$0"
|
|
|
|
printf " - %s -lint: install everything\n" "$0"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
nvim_script_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nvim/scripts
|
|
|
|
|
|
|
|
if [ "$1" = "-lsp" ]; then
|
2021-10-19 10:04:59 -04:00
|
|
|
printf "\033[1;33mInstalling lsp servers...\033[0m\n"
|
|
|
|
find "${nvim_script_dir}/lsp" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \;
|
2021-10-04 13:42:41 -04:00
|
|
|
elif [ "$1" = '-dap' ]; then
|
2021-10-19 10:04:59 -04:00
|
|
|
printf "\033[1;33mInstalling dap servers...\033[0m\n"
|
|
|
|
find "${nvim_script_dir}/dap" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \;
|
2021-10-04 13:42:41 -04:00
|
|
|
elif [ "$1" = '-lint' ]; then
|
2021-10-19 10:04:59 -04:00
|
|
|
printf "\033[1;33mInstalling linters and formatters...\033[0m\n"
|
|
|
|
find "${nvim_script_dir}/lint" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \;
|
2021-10-04 13:42:41 -04:00
|
|
|
elif [ "$1" = '-all' ]; then
|
2021-10-19 10:04:59 -04:00
|
|
|
printf "\033[1;33mInstalling everything...\033[0m\n"
|
|
|
|
find "${nvim_script_dir}" -mindepth 2 -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \;
|
2021-10-04 13:42:41 -04:00
|
|
|
else
|
|
|
|
# Each server should have an unique name
|
|
|
|
server_path=$(find "${nvim_script_dir}" -mindepth 2 -type f -name "$1" | head -n 1)
|
|
|
|
if [ -z "${server_path}" ]; then
|
2021-10-19 14:57:38 -04:00
|
|
|
printf "Incorrect server name \033[1;31m%s\033[0m.\n" "$1"
|
2021-10-04 13:42:41 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-10-19 10:04:59 -04:00
|
|
|
printf "\033[1;34mInstalling \033[1;32m%s\033[1;34m...\033[0m\n" "$1"
|
2021-10-04 13:42:41 -04:00
|
|
|
exec ${server_path}
|
|
|
|
fi
|