Created
August 2, 2021 04:45
-
-
Save mikemackintosh/9ba5faafa0ae331d22d72aef72cb0ef1 to your computer and use it in GitHub Desktop.
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
function cd () { | |
local DOTENV="\033[1;38;5;220m[\033[0;38;5;214md\033[0;38;5;215mo\033[0;38;5;216mt\033[0;38;5;217me\033[0;38;5;218mn\033[0;38;5;219mv\033[1;38;5;220m]\033[0m" | |
if [[ -f .env ]]; then | |
echo "${DOTENV} Unscoping \033[38;5;243m.env\033[0m configuration" | |
unset $(cat .env | cut -d'=' -f1) | |
fi | |
builtin cd "$@" | |
if [[ -f .env ]]; then | |
set -o allexport | |
echo "${DOTENV} Sourcing environment from \033[38;5;243m.env\033[0m" | |
source .env | |
set +o allexport | |
fi | |
} | |
function ".."() { cd .. } | |
function "../.."() { cd ../.. } | |
function "../../.."() { cd ../../.. } | |
function "../../../.."() { cd ../../../.. } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment