#!/usr/bin/env zsh # Eryn Wells function init_configure_ls { local has_gnu_ls local ls_options if [[ ! -e "$1" ]]; then ShellLog -l error 'Missing required path to ls binary' return fi if $1 --version 2>&1 | grep GNU 1>/dev/null; then has_gnu_ls=1 ls_options='--color=auto' else has_gnu_ls=0 ls_options='-G' fi ShellLog -l debug "Setting up aliases for $1" alias ls="$1 $ls_options" alias la="$1 -A $ls_options" alias ll="$1 -l $ls_options" alias l.="$1 -d $ls_options .*" local dircolors_bin=`whence -p dircolors || whence -p gdircolors` if [[ $has_gnu_ls -eq 1 && -n "$dircolors_bin" ]]; then if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then dircolors="$HOME/.dircolors/$SYS.cfg" else dircolors="$HOME/.dircolors/default.cfg" fi ShellLog -l debug "Setting up dircolors: `basename $dircolors`" eval `$dircolors_bin $dircolors` fi } init_configure_ls "$@"