summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcolor-ls17
1 files changed, 8 insertions, 9 deletions
diff --git a/color-ls b/color-ls
index ca23c87..d3b673a 100755
--- a/color-ls
+++ b/color-ls
@@ -23,21 +23,20 @@
# SOFTWARE.
# TODO: handle recursive stuff
-# TODO: change this back to -C when that is fixed
-output=x
+output=C
trim=1
+options=
-while getopts ACFHLRSacdfgiklmnopqrstux1 option
-do
- case $option in
+while getopts ACFHLRSacdfgiklmnopqrstux1 option; do
+ case ${option} in
l|o|n|g) output=${option};;
C|m|x) output=${option};;
1) output=1;;
F) trim=0;;
- ?) ;;
+ ?) options=${options}${option};;
esac
done
-# FIXME: the script returns 0 even if ls does not
-# FIXME: always pass -1 when needed, but do it before operands
-ls -F ${1+$@} | awk -vtrim=${trim} -voutput=${output} -f $(dirname $0)/color-ls.awk
+shift $(($OPTIND - 1))
+
+exec ls -${options}F1 -- ${1+$*} | awk -vtrim=${trim} -voutput=${output} -f $(dirname $0)/color-ls.awk