Conditionally add the eza command to list contents on cd

We dont want to blindly add it multiple times, that just causes the
contents of a directory to get listed multiple times when `cd`ing.
This commit is contained in:
Jonny Barnes 2025-01-19 13:38:48 +00:00
parent 6c532440e3
commit 3bd7aac84f
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8

View file

@ -36,7 +36,10 @@ ezacd () {
eza --oneline --long --classify --icons --header
}
chpwd_functions=(${chpwd_functions[@]} "ezacd")
# Only add ezacd to chpwd_functions if it's not already there
if (( ${chpwd_functions[(I)ezacd]} == 0 )); then
chpwd_functions=(${chpwd_functions[@]} "ezacd")
fi
# Go Lang stuff
export GOPATH=$HOME/go