added update nvim
This commit is contained in:
parent
ffc9fc2d95
commit
ea1633a1bc
|
@ -0,0 +1,20 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
GH_PROJECT="${1}"
|
||||
GH_DL_TAG="${2:-latest}"
|
||||
GH_FILTER="${3:-deb}"
|
||||
if [[ ! "$GH_FILTER" =~ '(' ]]; then
|
||||
GH_FILTER="contains(\"${GH_FILTER}\")"
|
||||
fi
|
||||
SRC_URL=https://api.github.com/repos/${GH_PROJECT}/releases/${GH_DL_TAG}
|
||||
DL_URL=$( \
|
||||
curl -sL curl ${SRC_URL} \
|
||||
| jq -r " \
|
||||
.assets[] \
|
||||
| select(.browser_download_url \
|
||||
| ${GH_FILTER} ) \
|
||||
| .browser_download_url \
|
||||
")
|
||||
[[ -n "$DL_URL" ]] \
|
||||
&& printf "%s\n" $DL_URL \
|
||||
|| return 1 2>/dev/null || exit 1
|
|
@ -0,0 +1,28 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
BASE_0=${BASE_0:-$0}
|
||||
BASE_SHELL=$(basename "$SHELL")
|
||||
|
||||
_update-nvim() {
|
||||
local LatestURL="$(get-github-release.sh \
|
||||
neovim/neovim latest appimage \
|
||||
| grep appimage\$
|
||||
)"
|
||||
local appPath="${HOME}/.local/bin/nvim.AppImage"
|
||||
|
||||
rm "${HOME}/.local/bin/"{nvim.AppImage,nvim,vi,vim} 2>/dev/null || true
|
||||
|
||||
printf 'Downloading from %s... ' "${LatestURL#*/download/}"
|
||||
curl -sLo "$appPath" "$LatestURL" && printf 'Done'
|
||||
printf '\n'
|
||||
chmod +x "$appPath"
|
||||
|
||||
ln -rs "$appPath" "${HOME}/.local/bin/nvim"
|
||||
ln -rs "$appPath" "${HOME}/.local/bin/vi"
|
||||
ln -rs "$appPath" "${HOME}/.local/bin/vim"
|
||||
}
|
||||
|
||||
_update-nvim "${@}"
|
||||
|
Loading…
Reference in New Issue