Last active
August 17, 2023 12:36
-
-
Save Jay-Madden/c048aae6e938ba79b0bb88ce897c26ed to your computer and use it in GitHub Desktop.
Bash script to display onefetch every time you navigate locally to a new repository
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
# Call onefetch if we navigate to a new repository | |
LAST_REPO="" | |
cd() { | |
builtin cd "$@"; | |
git rev-parse 2>/dev/null; | |
if [ $? -eq 0 ]; then | |
if [ "$LAST_REPO" != $(basename $(git rev-parse --show-toplevel)) ]; then | |
onefetch | |
LAST_REPO=$(basename $(git rev-parse --show-toplevel)) | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment