Fetch rel_path from ll args and prepend to files before setting env variable shortcuts

This commit is contained in:
Nathan Broadbent
2012-10-20 09:26:14 +13:00
parent 976c1ea704
commit 6607aec257

View File

@@ -95,6 +95,13 @@ if [ -n "$_ll_command" ]; then
function ll { function ll {
local ll_output="$($_ll_command "$@")" local ll_output="$($_ll_command "$@")"
# Parse path from args
OLDIFS="$IFS"; IFS=$'\n'
for arg in $@; do
if [ -d "$arg" ]; then local rel_path="${arg%/}"; fi
done
IFS="$OLDIFS"
# Replace user/group with user symbol, if defined at ~/.user_sym # Replace user/group with user symbol, if defined at ~/.user_sym
# Before : -rw-rw-r-- 1 ndbroadbent ndbroadbent 1.1K Sep 19 21:39 scm_breeze.sh # Before : -rw-rw-r-- 1 ndbroadbent ndbroadbent 1.1K Sep 19 21:39 scm_breeze.sh
# After : -rw-rw-r-- 1 𝐍 𝐍 1.1K Sep 19 21:39 scm_breeze.sh # After : -rw-rw-r-- 1 𝐍 𝐍 1.1K Sep 19 21:39 scm_breeze.sh
@@ -130,9 +137,10 @@ EOF
# Set numbered file shortcut in variable # Set numbered file shortcut in variable
local e=1 local e=1
local ll_files="$($_ll_sys_command "$@")" local ll_files="$($_ll_sys_command "$@")"
OLDIFS="$IFS"
IFS=$'\n' OLDIFS="$IFS"; IFS=$'\n'
for file in $ll_files; do for file in $ll_files; do
if [ -n "$rel_path" ]; then file="$rel_path/$file"; fi
export $git_env_char$e="$(eval $_abs_path_command \"$file\")" export $git_env_char$e="$(eval $_abs_path_command \"$file\")"
if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi if [ "${scmbDebug:-}" = "true" ]; then echo "Set \$$git_env_char$e => $file"; fi
let e++ let e++