Skip to content

Instantly share code, notes, and snippets.

@Jay-Madden
Last active August 17, 2023 12:36
Show Gist options
  • Save Jay-Madden/c048aae6e938ba79b0bb88ce897c26ed to your computer and use it in GitHub Desktop.
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
# 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