export/unset CLICOLOR_FORCE=1 var for ll command

This commit is contained in:
Nathan Broadbent
2012-10-21 11:20:59 +13:00
parent 281131ef27
commit adef82a838

View File

@@ -82,7 +82,7 @@ if [ "$_uname" = "Linux" ]; then
_abs_path_command="readlink -f" _abs_path_command="readlink -f"
elif [ "$_uname" = "Darwin" ]; then elif [ "$_uname" = "Darwin" ]; then
# OS X ls commands # OS X ls commands
_ll_command="CLICOLOR_FORCE=1 ls -l -G" _ll_command="ls -l -G"
_ll_sys_command="ls" _ll_sys_command="ls"
# Use perl abs_path, since readlink -f isn't available on OS X # Use perl abs_path, since readlink -f isn't available on OS X
_abs_path_command="perl -e 'use Cwd \"abs_path\"; print abs_path(shift)'" _abs_path_command="perl -e 'use Cwd \"abs_path\"; print abs_path(shift)'"
@@ -93,6 +93,8 @@ if [ -n "$_ll_command" ]; then
# Adds numbered shortcuts to output of ls -l, just like 'git status' # Adds numbered shortcuts to output of ls -l, just like 'git status'
unalias ll > /dev/null 2>&1; unset -f ll > /dev/null 2>&1 unalias ll > /dev/null 2>&1; unset -f ll > /dev/null 2>&1
function ls_with_file_shortcuts { function ls_with_file_shortcuts {
local OLDCLICOLOR_FORCE="$CLICOLOR_FORCE"
export CLICOLOR_FORCE=1
local ll_output="$($_ll_command "$@")" local ll_output="$($_ll_command "$@")"
# Parse path from args # Parse path from args
@@ -146,6 +148,7 @@ EOF
let e++ let e++
done done
IFS="$OLDIFS" IFS="$OLDIFS"
export CLICOLOR_FORCE="$OLDCLICOLOR_FORCE"
} }
fi fi