Git directory 'onefetch'
Alias 'cd' to create a flag. Detect flag during prompt script. If directory changed to the root of a git repository, print 'onefetch' Remove flag if set.
This commit is contained in:
parent
2020584c71
commit
0dcd93477a
|
@ -51,6 +51,9 @@ alias mpv="flatpak run io.mpv.Mpv"
|
|||
# Detect if I'm in a toolbox
|
||||
alias isdistrobox='[ -f "/run/.toolboxenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv'
|
||||
|
||||
# Flag that the directory was just changed (used with prompt)
|
||||
alias cd='export DIRCHANGED="1"; cd'
|
||||
|
||||
if [ $(isdistrobox) ]; then
|
||||
source $HOME/.dotfiles/bash/bash_aliases.distrobox
|
||||
else
|
||||
|
|
|
@ -9,6 +9,14 @@ elif [[ $ARG != '' ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# If directory was just changed to the root of a git repository, print onefetch
|
||||
if [ ! -z $DIRCHANGED ]; then
|
||||
if [ -d $PWD/.git ]; then
|
||||
$HOME/bin/onefetch
|
||||
fi
|
||||
unset DIRCHANGED
|
||||
fi
|
||||
|
||||
# Default colours
|
||||
# 0 default, 1 red 2 green 3 yellow 4 blue 5 magenta 6 cyan 7 white (grey)
|
||||
PC="0" # prompt default
|
||||
|
|
Loading…
Reference in New Issue