mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +08:00
Add checkRequirements
This commit is contained in:
parent
7e3d45c621
commit
aaadf28c98
@ -42,6 +42,10 @@ error() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
msg "${Red}[✘]${Color_off} ${1}${2}"
|
||||||
|
}
|
||||||
|
|
||||||
fetch_repo () {
|
fetch_repo () {
|
||||||
if [[ -d "$HOME/.SpaceVim" ]]; then
|
if [[ -d "$HOME/.SpaceVim" ]]; then
|
||||||
info "Trying to update SpaceVim"
|
info "Trying to update SpaceVim"
|
||||||
@ -121,6 +125,42 @@ uninstall_neovim () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_requirements () {
|
||||||
|
info "Checking Requirements for SpaceVim"
|
||||||
|
if hash "git" &>/dev/null; then
|
||||||
|
git_version=$(git --version)
|
||||||
|
success "Check Requirements: ${git_version}"
|
||||||
|
else
|
||||||
|
warn "Check Requirements : git"
|
||||||
|
fi
|
||||||
|
if hash "vim" &>/dev/null; then
|
||||||
|
is_vim8=$(vim --version | grep "Vi IMproved 8.0")
|
||||||
|
is_vim74=$(vim --version | grep "Vi IMproved 7.4")
|
||||||
|
if [ -n "$is_vim8" ]; then
|
||||||
|
success "Check Requirements: vim 8.0"
|
||||||
|
elif [ -n "$is_vim74" ]; then
|
||||||
|
success "Check Requirements: vim 7.4"
|
||||||
|
else
|
||||||
|
if hash "nvim" &>/dev/null; then
|
||||||
|
success "Check Requirements: nvim"
|
||||||
|
else
|
||||||
|
warn "SpaceVim need vim 7.4 or above"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if hash "nvim" &>/dev/null; then
|
||||||
|
success "Check Requirements: nvim"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if hash "nvim" &>/dev/null; then
|
||||||
|
success "Check Requirements: nvim"
|
||||||
|
else
|
||||||
|
warn "Check Requirements : vim or nvim"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
info "Checking true colors support in terminal:"
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/24-bit-color.sh)"
|
||||||
|
}
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "SpaceVim install script : V ${Version}"
|
echo "SpaceVim install script : V ${Version}"
|
||||||
echo ""
|
echo ""
|
||||||
@ -133,6 +173,7 @@ usage () {
|
|||||||
echo " -i, --install install spacevim for vim or neovim"
|
echo " -i, --install install spacevim for vim or neovim"
|
||||||
echo " -v, --version Show version information and exit"
|
echo " -v, --version Show version information and exit"
|
||||||
echo " -u, --uninstall Uninstall SpaceVim"
|
echo " -u, --uninstall Uninstall SpaceVim"
|
||||||
|
echo " -c, --checkRequirements checkRequirements for SpaceVim"
|
||||||
echo ""
|
echo ""
|
||||||
echo "EXAMPLE"
|
echo "EXAMPLE"
|
||||||
echo ""
|
echo ""
|
||||||
@ -160,6 +201,10 @@ then
|
|||||||
uninstall_neovim
|
uninstall_neovim
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
--checkRequirements|-c)
|
||||||
|
check_requirements
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
--install|-i)
|
--install|-i)
|
||||||
need_cmd 'git'
|
need_cmd 'git'
|
||||||
fetch_repo
|
fetch_repo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user