tzachar / cmp-tabnine

TabNine plugin for hrsh7th/nvim-cmp
MIT License
286 stars 28 forks source link

Failed to install tabnine from Git Bash #106

Closed bjjblackbelt closed 7 months ago

bjjblackbelt commented 7 months ago

When executing Neovim from Git Bash, which was installed using Chocolatey, the build step fails with the following message:

    ● cmp-tabnine 43.75ms  nvim-cmp
        ++ curl -sS https://update.tabnine.com/bundles/version
        + version=4.135.0
        ++ uname -s
        + os=MINGW64_NT-10.0-19045
        + [[ MINGW64_NT-10.0-19045 == \D\a\r\w\i\n ]]
        + [[ MINGW64_NT-10.0-19045 == \L\i\n\u\x ]]
        ++ dirname ./install.sh
        + cd .
        + path=4.135.0/
        + curl https://update.tabnine.com/bundles/4.135.0//TabNine.zip --create-dirs -o binaries/4.135.0//TabNine.zip
          % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                         Dload  Upload   Total   Spent    Left  Speed

100   454  100   454    0     0   1616      0 --:--:-- --:--:-- --:--:--  1627
        + unzip -o binaries/4.135.0//TabNine.zip -d binaries/4.135.0/
        Archive:  binaries/4.135.0//TabNine.zip
          End-of-central-directory signature not found.  Either this file is not
          a zipfile, or it constitutes one disk of a multi-part archive.  In the
          latter case the central directory and zipfile comment will be found on
          the last disk(s) of this archive.
        unzip:  cannot find zipfile directory in one of binaries/4.135.0//TabNine.zip or
                binaries/4.135.0//TabNine.zip.zip, and cannot find binaries/4.135.0//TabNine.zip.ZIP, period.
bjjblackbelt commented 7 months ago

Here is a fix. I am unable to create a pull request at this time.

install.sh

#!/usr/bin/env bash

# Based on https://github.com/codota/TabNine/blob/master/dl_binaries.sh
# Download latest TabNine binaries
set -o errexit
set -o pipefail
set -x

version=${version:-$(curl -sS https://update.tabnine.com/bundles/version)}

os=$(uname -s)
if [[ "$os" == "Darwin" ]]; then
    if [ "$(uname -m)" == "arm64" ]; then
        platform="aarch64-apple-darwin"
    else
        platform="$(uname -m)-apple-darwin"
    fi
elif [[ "$os" == "Linux" ]]; then
    platform="$(uname -m)-unknown-linux-musl"
elif [[ "$os" == *"MINGW64"* ]]; then
    platform="$(uname -m)-pc-windows-gnu"
fi

# we want the binary to reside inside our plugin's dir
cd "$(dirname "$0")"
path=$version/$platform

curl "https://update.tabnine.com/bundles/${path}/TabNine.zip" --create-dirs -o "binaries/${path}/TabNine.zip"
unzip -o "binaries/${path}/TabNine.zip" -d "binaries/${path}"
rm -rf "binaries/${path}/TabNine.zip"

if [[ "$os" != *"MINGW64"* ]]; then
    chmod +x "binaries/$path/*"
fi
tzachar commented 7 months ago

Why did you change the case into multiple if else ?