diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 13:09:10 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 13:09:10 +1200 |
commit | f7e851d9986a30e3d590d67b23e862a38d427472 (patch) | |
tree | 54725167ae5b729071f944e41fdc8ed753cf2283 /sh/shrc.d/ls.sh | |
parent | Merge branch 'freebsd' (diff) | |
download | dotfiles-f7e851d9986a30e3d590d67b23e862a38d427472.tar.gz dotfiles-f7e851d9986a30e3d590d67b23e862a38d427472.zip |
Clean up/extend grep()/ls() extension
Diffstat (limited to 'sh/shrc.d/ls.sh')
-rw-r--r-- | sh/shrc.d/ls.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh index eec25eb7..57f6ed24 100644 --- a/sh/shrc.d/ls.sh +++ b/sh/shrc.d/ls.sh @@ -5,11 +5,23 @@ # Define function proper ls() { + # Add --time-style='+%Y-%m-%d %H:%M:%S' to show trailing indicators of the filetype + [ -e "$HOME"/.cache/ls/time-style ] && + set -- --time-style='+%Y-%m-%d %H:%M:%S' "$@" + # Add --color if the terminal has at least 8 colors [ -e "$HOME"/.cache/ls/color ] && [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" + # Add --classify to show trailing indicators of the filetype + [ -e "$HOME"/.cache/ls/classify ] && + set -- --classify "$@" + + # Add --block-size=K to always show the filesize in kibibytes + [ -e "$HOME"/.cache/ls/block-size ] && + set -- --block-size=K "$@" + # Run ls(1) with the concluded arguments command ls "$@" } |