- ls_color=gnu
-else
- if ls -G >/dev/null 2>&1; then
- ls_color=cli
- else
- ls_color=
- fi
-fi
-# Absolute path to `ls`.
-ls_path=`installed_path ls`
-# GNU ls with colors.
-if test "x$ls_color" = xgnu; then
- ls_env=
- ls_color='--color'
-# Normal (BSD) ls with colors.
-elif test "x$ls_color" = xcli; then
- ls_env='CLICOLOR_FORCE=1'
- ls_color='-G'
+ ls_args='command ls --color'
+# Normal (BSD) ls with colors available.
+elif ls -G >/dev/null 2>&1; then
+ # Don't display hidden files by default when running as root (-I), I use
+ # `la` for that.
+ ls_args='CLICOLOR_FORCE=1 command ls -G -I'
+# OpenBSD has no colored ls, use colorls instead.
+elif colorls -G >/dev/null 2>&1; then
+ ls_args='CLICOLOR_FORCE=1 colorls -G'