2019-10-24 19:40:10 +00:00
|
|
|
#! /bin/bash
|
2019-10-29 21:55:44 +00:00
|
|
|
set -e
|
|
|
|
|
2019-11-20 23:19:14 +00:00
|
|
|
# Clear explicit PYTHONPATH since this gets confused between py2 and py3
|
|
|
|
export PYTHONPATH=""
|
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Determines if a command exists or not
|
|
|
|
function command_exist() {
|
2021-06-09 17:19:03 +00:00
|
|
|
command -v "$1" > /dev/null 2>&1;
|
2019-10-29 21:55:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Runs a command or spits out the output
|
|
|
|
function maybe_run() {
|
|
|
|
if command_exist "$1" ;then
|
|
|
|
echo "> $*"
|
2019-11-20 23:19:14 +00:00
|
|
|
# shellcheck disable=2048,2086
|
2019-10-29 21:55:44 +00:00
|
|
|
eval $*
|
|
|
|
else
|
|
|
|
echo "ERROR: $1 does not exist. Could not run $*"
|
|
|
|
fi
|
|
|
|
}
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
## Language servers
|
|
|
|
function install_language_servers() {
|
|
|
|
echo "### Installing language servers..."
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# bash
|
|
|
|
maybe_run npm install -g bash-language-server
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Kotlin
|
|
|
|
# https://github.com/fwcd/kotlin-language-server/blob/master/BUILDING.md
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Python
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade python-language-server
|
|
|
|
maybe_run pip3 install --user --upgrade python-language-server
|
2021-08-24 17:41:45 +00:00
|
|
|
maybe_run pip install --user python-lsp-server[all] || echo "WARNING: python-lsp-server is py3 only"
|
2021-08-24 16:59:12 +00:00
|
|
|
maybe_run pip3 install --user python-lsp-server[all]
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Rust
|
2019-11-20 23:19:14 +00:00
|
|
|
maybe_run rustup component add rls rustfmt rust-analysis rust-src
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2021-08-24 16:59:12 +00:00
|
|
|
# Go
|
|
|
|
maybe_run env GO111MODULE=on go get golang.org/x/tools/gopls@latest
|
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
echo ""
|
|
|
|
}
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
## Linters
|
|
|
|
function install_linters() {
|
|
|
|
echo "### Installing linters..."
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Python
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade flake8
|
|
|
|
maybe_run pip install --user --upgrade mypy || echo "WARNING: mypy is py3 only"
|
|
|
|
maybe_run pip3 install --user --upgrade flake8 mypy
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# CSS
|
|
|
|
maybe_run npm install -g csslint
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Vim
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade vim-vint
|
|
|
|
maybe_run pip3 install --user --upgrade vim-vint
|
2019-10-29 19:33:08 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# YAML
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade yamllint
|
|
|
|
maybe_run pip3 install --user --upgrade yamllint
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Text / Markdown
|
|
|
|
maybe_run npm install -g alex
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade proselint
|
|
|
|
maybe_run pip3 install --user --upgrade proselint
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
# Makefile
|
|
|
|
maybe_run go get -u github.com/mrtazz/checkmake
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
echo ""
|
|
|
|
}
|
2019-10-24 19:40:10 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
## Fixers
|
|
|
|
function install_fixers() {
|
|
|
|
echo "### Installing fixers..."
|
|
|
|
# CSS/JS/HTML/JSON/YAML/Markdown/and more!
|
|
|
|
maybe_run npm install -g prettier
|
|
|
|
|
|
|
|
# Python
|
2021-07-26 23:37:54 +00:00
|
|
|
maybe_run pip install --user --upgrade autopep8 reorder-python-imports
|
2021-08-24 23:10:37 +00:00
|
|
|
maybe_run pip install --user --upgrade black pyls-black python-lsp-black pyls-isort pyls-mypy || echo "WARNING: black is py3 only"
|
|
|
|
maybe_run pip3 install --user --upgrade black pyls-black python-lsp-black pyls-isort pyls-mypy autopep8 reorder-python-imports
|
2019-10-29 21:55:44 +00:00
|
|
|
|
|
|
|
# Rust
|
|
|
|
maybe_run rustup component add rustfmt
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
install_language_servers
|
|
|
|
install_linters
|
|
|
|
install_fixers
|
2019-10-30 00:33:14 +00:00
|
|
|
|
2019-10-29 21:55:44 +00:00
|
|
|
echo ""
|
|
|
|
echo "DONE"
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|