Remove separator as a script, put as a function

This commit is contained in:
flyingscorpio@arch-desktop 2020-04-08 17:38:14 +02:00
parent b22ac207d6
commit 623aa5bb7a
3 changed files with 29 additions and 45 deletions

View file

@ -1,11 +0,0 @@
#!/bin/bash
## This script is used to visually separate commands in the other scripts
if [ $? -eq 0 ]; then
echo -n "${GREEN}"
else
echo -n "${RED}"
fi
echo "========================================"
echo "${NC}"

View file

@ -24,8 +24,6 @@ else
echo "Nothing changed.${NC}" echo "Nothing changed.${NC}"
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Add colors {{{ # Add colors {{{
@ -38,8 +36,6 @@ for color_file in $color_files; do
ln -rs "$BASE_DIR"/dotfiles/vim_colors/"$color_file" ~/.vim/colors/ 2> /dev/null ln -rs "$BASE_DIR"/dotfiles/vim_colors/"$color_file" ~/.vim/colors/ 2> /dev/null
done done
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Install or update Vundle {{{ # Install or update Vundle {{{
@ -63,8 +59,6 @@ else
fi fi
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Update Vundle plugins {{{ # Update Vundle plugins {{{
@ -86,8 +80,6 @@ if [ "$UPDATE" = 'true' ]; then
fi fi
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Setup git-submodules for python-mode {{{ # Setup git-submodules for python-mode {{{
@ -103,8 +95,6 @@ if [ -e ~/.vim/bundle/python-mode ]; then
fi fi
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Install linters {{{ # Install linters {{{
@ -142,8 +132,6 @@ else
exit 1 exit 1
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Install YouCompleteMe {{{ # Install YouCompleteMe {{{
@ -171,8 +159,6 @@ else
echo "YouCompleteMe is already installed, skipping..." echo "YouCompleteMe is already installed, skipping..."
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
# Add YouCompleteMe extra conf files {{{ # Add YouCompleteMe extra conf files {{{
@ -182,8 +168,6 @@ echo "Adding YouCompleteMe extra_conf files..."
ln -rs "$BASE_DIR"/dotfiles/ycm_extra_conf.py ~/.ycm_extra_conf.py 2> /dev/null ln -rs "$BASE_DIR"/dotfiles/ycm_extra_conf.py ~/.ycm_extra_conf.py 2> /dev/null
ln -rs "$BASE_DIR"/dotfiles/global_extra_conf.py ~/.global_extra_conf.py 2> /dev/null ln -rs "$BASE_DIR"/dotfiles/global_extra_conf.py ~/.global_extra_conf.py 2> /dev/null
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh
# }}} # }}}
exit 0 exit 0

View file

@ -13,6 +13,17 @@ export GREEN
export ORANGE export ORANGE
export NC export NC
separator() {
exit_status=$?
if [ $exit_status -eq 0 ]; then
echo -n "${GREEN}"
else
echo -n "${RED}"
fi
echo "========================================"
echo "${NC}"
}
BASE_DIR="$PWD" BASE_DIR="$PWD"
export BASE_DIR export BASE_DIR
@ -91,7 +102,7 @@ else
exit 1 exit 1
fi fi
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh separator
# }}} # }}}
@ -101,7 +112,7 @@ echo "Setting up configuration for Vim"
/bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh /bin/bash "$BASE_DIR"/installation_scripts/vim_update.sh
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh separator
# }}} # }}}
@ -111,36 +122,36 @@ echo "Configuring ProtonVPN..."
sudo protonvpn init && sudo protonvpn c --cc CH sudo protonvpn init && sudo protonvpn c --cc CH
/bin/bash "$BASE_DIR"/installation_scripts/separator.sh separator
# }}} # }}}
# Update .bashrc {{{ # Update .bashrc {{{
echo "Updating .bashrc..." echo "Updating .bashrc..."
if cp ~/SetupCockpit/dotfiles/bashrc ~/.bashrc; then
echo "${GREEN}Successfully updated .bashrc${NC}" if [ ! -L ~/.bashrc ]; then
else ln -rs "$BASE_DIR"/dotfiles/bashrc ~/.bashrc 2> /dev/null
echo "${ORANGE}There was a problem while updating .bashrc${NC}"
fi fi
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
# Update .bash_aliases {{{ # Update .bash_aliases {{{
echo "Updating .bash_aliases..." echo "Updating .bash_aliases..."
if cp ~/SetupCockpit/dotfiles/bash_aliases ~/.bash_aliases; then
echo "${GREEN}Successfully updated .bash_aliases${NC}" if [ ! -L ~/.bash_aliases ]; then
else ln -rs "$BASE_DIR"/dotfiles/bash_aliases ~/.bash_aliases 2> /dev/null
echo "${ORANGE}There was a problem while updating .bash_aliases${NC}"
fi fi
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
exit
# Configure Git {{{ # Configure Git {{{
echo "Configuring Git..." echo "Configuring Git..."
@ -151,7 +162,7 @@ git config --global alias.co "checkout"
git config --global alias.st "status" git config --global alias.st "status"
git config --global alias.br "branch" git config --global alias.br "branch"
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
@ -169,7 +180,7 @@ else
fi fi
fi fi
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
@ -184,7 +195,7 @@ else
git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
fi fi
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
@ -204,7 +215,7 @@ echo "<?xml version=\"1.0\"?>
</mime-info>" > ~/.local/share/mime/packages/text-markdown.xml </mime-info>" > ~/.local/share/mime/packages/text-markdown.xml
fi fi
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}
@ -214,6 +225,6 @@ echo "Cloning projects..."
/bin/bash clone_projects.sh /bin/bash clone_projects.sh
/bin/bash ~/SetupCockpit/separator.sh separator
# }}} # }}}