Skip to content

Commit

Permalink
fix(system): improve ls coloring OS conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
seantrane committed May 15, 2023
1 parent 1004888 commit a34f7b7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions system/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
alias reload="exec $SHELL -l"

# Detect which `ls` flavor is in use
if [[ "$OSTYPE" == "darwin"* ]]; then
colorflag="-G"
timeflag="-T"
elif ls --color > /dev/null 2>&1; then # GNU `ls`
# FreeBSD, older versions of OS X, have different ls command.
if ls --color > /dev/null 2>&1; then
colorflag="--color"
timeflag="--time-style=long-iso"
else # OS X `ls`
else
colorflag="-G"
fi
if ls -T > /dev/null 2>&1; then
timeflag="-T"
else
timeflag="--time-style=long-iso"
fi
# shellcheck disable=SC2034
colortimeflags="${colorflag} ${timeflag}"
Expand Down

0 comments on commit a34f7b7

Please sign in to comment.