Correction du echo + ajout du ctrl c
This commit is contained in:
parent
d9aa5f526e
commit
6a8ba8f85a
126
vimscode.sh
126
vimscode.sh
|
|
@ -1,85 +1,115 @@
|
||||||
install(){
|
#!/bin/bash
|
||||||
echo -e "INSTALLATION DE VIMSCODE\r"
|
|
||||||
echo -e 'Installation en cours : [--------------------](0%)\r'
|
# Fonction pour gérer l'interruption du script
|
||||||
|
cleanup() {
|
||||||
|
printf "\nInterruption du script...\n"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Capturer le signal SIGINT (Ctrl+C)
|
||||||
|
trap cleanup SIGINT
|
||||||
|
|
||||||
|
install() {
|
||||||
|
printf "INSTALLATION DE VIMSCODE\n"
|
||||||
|
printf 'Installation en cours : [--------------------](0%%)\r'
|
||||||
|
|
||||||
sudo apt update > /dev/null 2>&1
|
sudo apt update > /dev/null 2>&1
|
||||||
sudo apt install elinks figlet -y > /dev/null 2>&1
|
sudo apt install elinks figlet -y > /dev/null 2>&1
|
||||||
echo -e 'Installation en cours : [#####---------------](25%)\r'
|
printf 'Installation en cours : [#####---------------](25%%)\r'
|
||||||
|
|
||||||
mkdir ~/.vim && mv * ~/.vim
|
if [ ! -d "$HOME/.vim" ]; then
|
||||||
cd ~/.vim && mv vimrc-conf ~/.vimrc && mv vimrc2-conf ~/.vimrc2
|
mkdir ~/.vim && mv * ~/.vim
|
||||||
cd ~/.vim/bundle/ && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim > /dev/null 2>&1
|
fi
|
||||||
sudo mv ~/.vim/install.sh /bin/
|
|
||||||
echo -e 'Installation en cours : [##########----------](50%)\r'
|
cd ~/.vim && mv vimrc-conf ~/.vimrc && mv vimrc2-conf ~/.vimrc2
|
||||||
|
cd bundle/ && git clone https://github.com/VundleVim/Vundle.vim.git > /dev/null 2>&1
|
||||||
|
sudo mv ~/.vim/vimscode.sh /bin/
|
||||||
|
|
||||||
|
printf 'Installation en cours : [##########----------](50%%)\r'
|
||||||
|
|
||||||
echo "Utilisez-vous bash ou zsh ?"
|
printf "Utilisez-vous bash ou zsh ? "
|
||||||
read -r term
|
read -r term
|
||||||
|
|
||||||
if [ "$term" = "bash" ]; then
|
if [ "$term" = "bash" ]; then
|
||||||
if ! cat ~/.bashrc | grep -q 'alias vimscode="/bin/vimscode.sh"'; then
|
if ! grep -q 'alias vimscode="/bin/vimscode.sh"' ~/.bashrc; then
|
||||||
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.bashrc
|
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.bashrc
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! cat ~/.zshrc | grep -q 'alias vimscode="/bin/vimscode.sh"'; then
|
if ! grep -q 'alias vimscode="/bin/vimscode.sh"' ~/.zshrc; then
|
||||||
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.zshrc
|
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.zshrc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e 'Configuration en cours : [###############-----](75%)\r'
|
|
||||||
|
printf 'Configuration en cours : [###############-----](75%%)\r'
|
||||||
|
|
||||||
vim -u ~/.vimrc2 -c PluginInstall -c q -c q > /dev/null 2>&1
|
vim -u ~/.vimrc2 -c PluginInstall -c q -c q > /dev/null 2>&1
|
||||||
rm -rf ~/.vimrc2
|
rm -rf ~/.vimrc2
|
||||||
echo -e 'Configuration en cours : [####################](100%)\r'
|
printf 'Configuration en cours : [####################](100%%)\r\n'
|
||||||
|
|
||||||
echo "Installation terminée."
|
printf "Installation terminée.\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fonction pour la mises a jour de Vimscode
|
# Fonction pour la mise à jour de VimsCode
|
||||||
maj(){
|
maj() {
|
||||||
|
printf "Mise à jour en cours...\n"
|
||||||
echo -e "Mise à jour en cours..."
|
printf 'Début de la mise à jour : [-----------------](0%%)\r'
|
||||||
echo -e 'Début de la mise à jour : [-----------------](0%)\r'
|
|
||||||
rm -rf ~/.vim ~/.vimrc
|
rm -rf ~/.vim ~/.vimrc
|
||||||
git clone https://git.cohabit.fr/bastien/VimsCode.git > /dev/null 2>&1 && cd VimsCode
|
git clone https://git.cohabit.fr/bastien/VimsCode.git > /dev/null 2>&1 && cd VimsCode
|
||||||
|
|
||||||
mkdir ~/.vim && mv * ~/.vim
|
if [ ! -d "$HOME/.vim" ]; then
|
||||||
cd ~/.vim && mv vimrc-conf ~/.vimrc && mv vimrc2-conf ~/.vimrc2
|
mkdir ~/.vim && mv * ~/.vim
|
||||||
cd ~/.vim/bundle/ && git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim > /dev/null 2>&1
|
fi
|
||||||
echo -e 'Mise à jour en cours : [#####---------------](25%)\r'
|
|
||||||
|
cd ~/.vim && mv vimrc-conf ~/.vimrc && mv vimrc2-conf ~/.vimrc2
|
||||||
|
cd bundle/ && git clone https://github.com/VundleVim/Vundle.vim.git > /dev/null 2>&1
|
||||||
|
sudo mv ~/.vim/vimscode.sh /bin/
|
||||||
|
|
||||||
|
printf 'Mise à jour en cours : [#####---------------](25%%)\r'
|
||||||
|
|
||||||
echo "Utilisez-vous bash ou zsh ?"
|
printf "Utilisez-vous bash ou zsh ? "
|
||||||
read -r term
|
read -r term
|
||||||
|
|
||||||
if [ "$term" = "bash" ]; then
|
if [ "$term" = "bash" ]; then
|
||||||
if ! cat ~/.bashrc | grep -q 'alias vimscode="/bin/vimscode.sh"'; then
|
if ! grep -q 'alias vimscode="/bin/vimscode.sh"' ~/.bashrc; then
|
||||||
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.bashrc
|
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.bashrc
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! cat ~/.zshrc | grep -q 'alias vimscode="/bin/vimscode.sh"'; then
|
if ! grep -q 'alias vimscode="/bin/vimscode.sh"' ~/.zshrc; then
|
||||||
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.zshrc
|
echo 'alias vimscode="/bin/vimscode.sh"' >> ~/.zshrc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e 'Mise à jour en cours : [##########----------](50%)\r'
|
|
||||||
|
printf 'Mise à jour en cours : [##########----------](50%%)\r'
|
||||||
|
|
||||||
vim -u ~/.vimrc2 -c PluginInstall -c q -c q > /dev/null 2>&1
|
vim -u ~/.vimrc2 -c PluginInstall -c q -c q > /dev/null 2>&1
|
||||||
rm -rf ~/.vimrc2
|
rm -rf ~/.vimrc2
|
||||||
echo -e 'Mise à jour en cours : [###############-----](75%)\r'
|
printf 'Mise à jour en cours : [###############-----](75%%)\r'
|
||||||
|
|
||||||
cd ../ && rm -rf Vimscode
|
cd ../ && rm -rf VimsCode
|
||||||
echo -e 'Mise à jour fini : [####################](100%)\r'
|
printf 'Mise à jour fini : [####################](100%%)\r\n'
|
||||||
echo -e "Mise à jour terminé."
|
printf "Mise à jour terminée.\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "-maj" ]; then
|
# Gestion des arguments
|
||||||
maj
|
case "$1" in
|
||||||
elif [ "$1" = '-install' ] ; then
|
-maj)
|
||||||
install
|
maj
|
||||||
elif [ "$1" = '-a' ] || [ "$1" = '-arduino' ] ; then
|
;;
|
||||||
vim -p $2 ~/.vim/help/En/help-arduino
|
-install)
|
||||||
elif [ "$1" = '-e' ] || [ "$1" = '-esp' ] ; then
|
install
|
||||||
vim -p $2 ~/.vim/help/En/help-esp32
|
;;
|
||||||
elif [ "$1" = '-p' ] || [ "$1" = '-platform.io' ] ; then
|
-a | -arduino)
|
||||||
vim -p $2 ~/.vim/help/En/help-platform.io
|
vim -p "$2" ~/.vim/help/En/help-arduino
|
||||||
elif [ "$1" = '' ] || [ "$1" = '' ] ; then
|
;;
|
||||||
cat ~/.vim/help/help-vimscode
|
-e | -esp)
|
||||||
else
|
vim -p "$2" ~/.vim/help/En/help-esp32
|
||||||
echo "Commande invalide"
|
;;
|
||||||
fi
|
-p | -platform.io)
|
||||||
|
vim -p "$2" ~/.vim/help/En/help-platform.io
|
||||||
|
;;
|
||||||
|
'')
|
||||||
|
cat ~/.vim/help/help-vimscode
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Commande invalide"
|
||||||
Loading…
Reference in a new issue