Last active
March 16, 2020 21:02
-
-
Save Azrrael-exe/d7286f2d37dbb45fe033d88b0cc94f00 to your computer and use it in GitHub Desktop.
Custom .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IS_VENV=false | |
function virtualenv_check(){ | |
if [ -d "${PWD}/venv" ] && ! $IS_VENV; | |
then | |
echo "--- Virtualenv Activate---" | |
source venv/bin/activate | |
IS_VENV=true | |
if [ -d "${PWD}/venv/etc/jupyter" ]; | |
then | |
echo "Jupyter detected do you want to launch it? (Y/N)" | |
read LAUNCH | |
if [ $LAUNCH == "y" ] || [ $LAUNCH == "Y" ]; | |
then | |
jupyter notebook | |
fi | |
fi | |
elif $IS_VENV; | |
then | |
deactivate | |
echo "--- Virtualenv Deactivated--" | |
IS_VENV=false | |
fi | |
} | |
function node_check(){ | |
if [ -f "${PWD}/package.json" ]; | |
then | |
echo "--- Node Project ---" | |
if [ ! -d "${PWD}/node_modules" ]; | |
then | |
echo "Do you want to install the packages? (Y/N)" | |
read INSTALL | |
if [ $INSTALL == "y" ] || [ $INSTALL == "Y" ]; | |
then | |
npm install | |
fi | |
fi | |
fi | |
} | |
function platformio_check(){ | |
if [ -f "${PWD}/platformio.ini" ]; | |
then | |
echo "--- Platformio Project ---" | |
fi | |
} | |
check_cd () { | |
cd "$@" | |
virtualenv_check | |
node_check | |
platformio_check | |
} | |
alias cd="check_cd" | |
PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \[\033[0;36m\]\h \w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] ▶\[\033[0m\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment