feat(bash): run ls for symlink and binary files with l (#96)

Reviewed-on: https://codeberg.org/vlw/dotfiles/pulls/96
This commit is contained in:
Victor Westerlund 2025-12-25 12:07:11 +01:00
parent 5dfd6cebaa
commit 0626cf69ea

View file

@ -17,6 +17,19 @@ l () {
local target="${1:-$(pwd)}" local target="${1:-$(pwd)}"
if [ -f $target ] ; then if [ -f $target ] ; then
# Target is not a text file
if [ -L $target ] || grep -q -P "[^\x00-\x7F]" $target; then
ls -lah $target
# Target is not a symlink, so it must be binary
if [ ! -L $target ]; then
echo ""
echo -e "\033[96mBinary file. Run 'll $target' to preview anyways.\e[0m"
fi
return
fi
less $target less $target
return return
fi fi