diff options
author | Luc Sinet <[email protected]> | 2021-07-19 18:20:54 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-19 20:50:54 +0430 |
commit | a3ab8b0df87947396d134b5d73857dfb03a587ee (patch) | |
tree | 3193bbdb270d3d14241368522b8c5ca7b4ea4885 | |
parent | bdd6e0cf3738911ebe92b3ed7dcb52d84b7efa98 (diff) |
[Bugfix] lint script files (#1026)
-rwxr-xr-x | utils/bin/jdtls | 77 | ||||
-rwxr-xr-x | utils/installer/install.sh | 220 | ||||
-rwxr-xr-x[-rw-r--r--] | utils/installer/install_stylua.sh | 0 |
3 files changed, 149 insertions, 148 deletions
diff --git a/utils/bin/jdtls b/utils/bin/jdtls index cc73e59f..f23d85dd 100755 --- a/utils/bin/jdtls +++ b/utils/bin/jdtls @@ -8,32 +8,31 @@ # to point to the `config_mac' or `config_win` folders depending on your system. case Darwin in - Linux) - CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_linux" - ;; - Darwin) - CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_mac" - ;; +Linux) + CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_linux" + ;; +Darwin) + CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_mac" + ;; esac - # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ]; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." @@ -41,23 +40,23 @@ fi # JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar" JAR="$HOME/.local/share/nvim/lspinstall/java/plugins/org.eclipse.equinox.launcher_*.jar" -GRADLE_HOME=$HOME/gradle "$JAVACMD" \ - -Declipse.application=org.eclipse.jdt.ls.core.id1 \ - -Dosgi.bundles.defaultStartLevel=4 \ - -Declipse.product=org.eclipse.jdt.ls.core.product \ - -Dlog.protocol=true \ - -Dlog.level=ALL \ - -javaagent:$HOME/.local/share/nvim/lspinstall/java/lombok.jar \ - -Xms1g \ - -Xmx2G \ - -jar $(echo "$JAR") \ - -configuration "$CONFIG" \ - -data "${1:-$HOME/workspace}" \ - --add-modules=ALL-SYSTEM \ - --add-opens java.base/java.util=ALL-UNNAMED \ - --add-opens java.base/java.lang=ALL-UNNAMED - - # for older java versions if you wanna use lombok - # -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \ - - # -javaagent:/usr/local/share/lombok/lombok.jar \ +GRADLE_HOME="$HOME/gradle" "$JAVACMD" \ + -Declipse.application=org.eclipse.jdt.ls.core.id1 \ + -Dosgi.bundles.defaultStartLevel=4 \ + -Declipse.product=org.eclipse.jdt.ls.core.product \ + -Dlog.protocol=true \ + -Dlog.level=ALL \ + -javaagent:"$HOME/.local/share/nvim/lspinstall/java/lombok.jar" \ + -Xms1g \ + -Xmx2G \ + -jar "$JAR" \ + -configuration "$CONFIG" \ + -data "${1:-$HOME/workspace}" \ + --add-modules=ALL-SYSTEM \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED + +# for older java versions if you wanna use lombok +# -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \ + +# -javaagent:/usr/local/share/lombok/lombok.jar \ diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 36178ae5..96570840 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -5,207 +5,209 @@ set -o nounset # error when referencing undefined variable set -o errexit # exit when command fails installnodemac() { - brew install lua - brew install node - brew install yarn + brew install lua + brew install node + brew install yarn } installnodeubuntu() { - sudo apt install nodejs - sudo apt install npm + sudo apt install nodejs + sudo apt install npm } moveoldnvim() { - echo "Not installing LunarVim" - echo "Please move your ~/.config/nvim folder before installing" - exit + echo "Not installing LunarVim" + echo "Please move your ~/.config/nvim folder before installing" + exit } installnodearch() { - sudo pacman -S nodejs - sudo pacman -S npm + sudo pacman -S nodejs + sudo pacman -S npm } installnodefedora() { - sudo dnf install -y nodejs - sudo dnf install -y npm + sudo dnf install -y nodejs + sudo dnf install -y npm } installnodegentoo() { - echo "Printing current node status..." - emerge -pqv net-libs/nodejs - echo "Make sure the npm USE flag is enabled for net-libs/nodejs" - echo "If it isn't enabled, would you like to enable it with flaggie? (Y/N)" - read answer - [ "$answer" != "${answer#[Yy]}" ] && sudo flaggie net-libs/nodejs +npm - sudo emerge -avnN net-libs/nodejs + echo "Printing current node status..." + emerge -pqv net-libs/nodejs + echo "Make sure the npm USE flag is enabled for net-libs/nodejs" + echo "If it isn't enabled, would you like to enable it with flaggie? (Y/N)" + read -r answer + [ "$answer" != "${answer#[Yy]}" ] && sudo flaggie net-libs/nodejs +npm + sudo emerge -avnN net-libs/nodejs } installnode() { - echo "Installing node..." - [ "$(uname)" == "Darwin" ] && installnodemac - [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installnodeubuntu - [ -f "/etc/arch-release" ] && installnodearch - [ -f "/etc/artix-release" ] && installnodearch - [ -f "/etc/fedora-release" ] && installnodefedora - [ -f "/etc/gentoo-release" ] && installnodegentoo - [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported" - sudo npm i -g neovim + echo "Installing node..." + [ "$(uname)" = "Darwin" ] && installnodemac + grep -q Ubuntu /etc/os-release && installnodeubuntu + [ -f "/etc/arch-release" ] && installnodearch + [ -f "/etc/artix-release" ] && installnodearch + [ -f "/etc/fedora-release" ] && installnodefedora + [ -f "/etc/gentoo-release" ] && installnodegentoo + [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" + sudo npm i -g neovim } installpiponmac() { - sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - python3 get-pip.py - rm get-pip.py + sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + python3 get-pip.py + rm get-pip.py } installpiponubuntu() { - sudo apt install python3-pip >/dev/null + sudo apt install python3-pip >/dev/null } installpiponarch() { - sudo pacman -S python-pip + sudo pacman -S python-pip } installpiponfedora() { - sudo dnf install -y pip >/dev/nul + sudo dnf install -y pip >/dev/null } installpipongentoo() { - sudo emerge -avn dev-python/pip + sudo emerge -avn dev-python/pip } installpip() { - echo "Installing pip..." - [ "$(uname)" == "Darwin" ] && installpiponmac - [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installpiponubuntu - [ -f "/etc/arch-release" ] && installpiponarch - [ -f "/etc/fedora-release" ] && installpiponfedora - [ -f "/etc/gentoo-release" ] && installpipongentoo - [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported" + echo "Installing pip..." + [ "$(uname)" = "Darwin" ] && installpiponmac + grep -q Ubuntu /etc/os-release && installpiponubuntu + [ -f "/etc/arch-release" ] && installpiponarch + [ -f "/etc/fedora-release" ] && installpiponfedora + [ -f "/etc/gentoo-release" ] && installpipongentoo + [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" } installpynvim() { - echo "Installing pynvim..." - if [ -f "/etc/gentoo-release" ]; then - echo "Installing using Portage" - sudo emerge -avn dev-python/pynvim - else - pip3 install pynvim --user - fi + echo "Installing pynvim..." + if [ -f "/etc/gentoo-release" ]; then + echo "Installing using Portage" + sudo emerge -avn dev-python/pynvim + else + pip3 install pynvim --user + fi } installpacker() { - git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim + git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim } cloneconfig() { - echo "Cloning LunarVim configuration" - git clone --branch $LVBRANCH https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim - cp $HOME/.config/nvim/utils/installer/lv-config.example-no-ts.lua $HOME/.config/nvim/lv-config.lua - nvim --headless \ - +'autocmd User PackerComplete sleep 100m | qall' \ - +PackerInstall + echo "Cloning LunarVim configuration" + git clone --branch "$LVBRANCH" https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim + cp "$HOME/.config/nvim/utils/installer/lv-config.example-no-ts.lua" "$HOME/.config/nvim/lv-config.lua" + nvim --headless \ + +'autocmd User PackerComplete sleep 100m | qall' \ + +PackerInstall - nvim --headless \ - +'autocmd User PackerComplete sleep 100m | qall' \ - +PackerSync + nvim --headless \ + +'autocmd User PackerComplete sleep 100m | qall' \ + +PackerSync - echo -e "\nCompile Complete" - rm $HOME/.config/nvim/lv-config.lua - cp $HOME/.config/nvim/utils/installer/lv-config.example.lua $HOME/.config/nvim/lv-config.lua - # nvim --headless -cq ':silent TSUpdate' -cq ':qall' >/dev/null 2>&1 + printf "\nCompile Complete\n" + rm "$HOME/.config/nvim/lv-config.lua" + cp "$HOME/.config/nvim/utils/installer/lv-config.example.lua" "$HOME/.config/nvim/lv-config.lua" + # nvim --headless -cq ':silent TSUpdate' -cq ':qall' >/dev/null 2>&1 } asktoinstallnode() { - echo "node not found" - echo -n "Would you like to install node now (y/n)? " - read answer - [ "$answer" != "${answer#[Yy]}" ] && installnode + echo "node not found" + printf "Would you like to install node now (y/n)? " + read -r answer + [ "$answer" != "${answer#[Yy]}" ] && installnode } asktoinstallpip() { - # echo "pip not found" - # echo -n "Would you like to install pip now (y/n)? " - # read answer - # [ "$answer" != "${answer#[Yy]}" ] && installpip - echo "Please install pip3 before continuing with install" - exit + # echo "pip not found" + # echo -n "Would you like to install pip now (y/n)? " + # read answer + # [ "$answer" != "${answer#[Yy]}" ] && installpip + echo "Please install pip3 before continuing with install" + exit } installonmac() { - brew install ripgrep fzf - npm install -g tree-sitter-cli + brew install ripgrep fzf + npm install -g tree-sitter-cli } installonubuntu() { - sudo apt install ripgrep fzf - sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev - pip3 install neovim-remote - npm install -g tree-sitter-cli + sudo apt install ripgrep fzf + sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev + pip3 install neovim-remote + npm install -g tree-sitter-cli } installonarch() { - sudo pacman -S ripgrep fzf - pip3 install neovim-remote - npm install -g tree-sitter-cli + sudo pacman -S ripgrep fzf + pip3 install neovim-remote + npm install -g tree-sitter-cli } installonfedora() { - sudo dnf groupinstall "X Software Development" - sudo dnf install -y fzf ripgrep + sudo dnf groupinstall "X Software Development" + sudo dnf install -y fzf ripgrep } installongentoo() { - sudo emerge -avn sys-apps/ripgrep app-shells/fzf dev-python/neovim-remote virtual/jpeg sys-libs/zlib - npm install -g tree-sitter-cli + sudo emerge -avn sys-apps/ripgrep app-shells/fzf dev-python/neovim-remote virtual/jpeg sys-libs/zlib + npm install -g tree-sitter-cli } installextrapackages() { - [ "$(uname)" == "Darwin" ] && installonmac - [ -n "$(cat /etc/os-release | grep Ubuntu)" ] && installonubuntu - [ -f "/etc/arch-release" ] && installonarch - [ -f "/etc/artix-release" ] && installonarch - [ -f "/etc/fedora-release" ] && installonfedora - [ -f "/etc/gentoo-release" ] && installongentoo - [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ] && echo "Windows not currently supported" + [ "$(uname)" = "Darwin" ] && installonmac + grep -q Ubuntu /etc/os-release && installonubuntu + [ -f "/etc/arch-release" ] && installonarch + [ -f "/etc/artix-release" ] && installonarch + [ -f "/etc/fedora-release" ] && installonfedora + [ -f "/etc/gentoo-release" ] && installongentoo + [ "$(uname -s | cut -c 1-10)" = "MINGW64_NT" ] && echo "Windows not currently supported" } # Welcome echo 'Installing LunarVim' -if [[ $* == *--overwrite* ]]; then - echo '!!Warning!! -> Removing all nvim related config because of the --overwrite flag' - rm -rf "$HOME/.config/nvim" - rm -rf "$HOME/.cache/nvim" - rm -rf "$HOME/.local/share/nvim/site/pack/packer" -fi +case "$@" in +*--overwrite*) + echo '!!Warning!! -> Removing all nvim related config because of the --overwrite flag' + rm -rf "$HOME/.config/nvim" + rm -rf "$HOME/.cache/nvim" + rm -rf "$HOME/.local/share/nvim/site/pack/packer" + ;; +esac # move old nvim directory if it exists [ -d "$HOME/.config/nvim" ] && moveoldnvim # install pip -which pip3 >/dev/null && echo "pip installed, moving on..." || asktoinstallpip +(which pip3 >/dev/null && echo "pip installed, moving on...") || asktoinstallpip # install node and neovim support -which node >/dev/null && echo "node installed, moving on..." || asktoinstallnode +(which node >/dev/null && echo "node installed, moving on...") || asktoinstallnode # install pynvim -pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on..." || installpynvim +(pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on...") || installpynvim if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then - echo 'packer already installed' + echo 'packer already installed' else - installpacker + installpacker fi if [ -e "$HOME/.config/nvim/init.lua" ]; then - echo 'LunarVim already installed' + echo 'LunarVim already installed' else - # clone config down - cloneconfig - # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc - # echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc + # clone config down + cloneconfig + # echo 'export PATH=$HOME/.config/nvim/utils/bin:$PATH' >>~/.zshrc + # echo 'export PATH=$HOME/.config/lunarvim/utils/bin:$PATH' >>~/.bashrc fi echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts" diff --git a/utils/installer/install_stylua.sh b/utils/installer/install_stylua.sh index cd8b3942..cd8b3942 100644..100755 --- a/utils/installer/install_stylua.sh +++ b/utils/installer/install_stylua.sh |