nicer output

This commit is contained in:
Vincent Riquer 2013-05-16 11:55:01 +02:00
parent a51d00b2e9
commit 5365eb1189

View File

@ -114,6 +114,18 @@ then
exec > "$output"
fi
printPath() {
for key in ${!pathparts[@]}
do
if [[ ${pathparts[key]} == ${oldpathparts[key]} ]]
then
echo -n " ${pathparts[key]//?/ }"
else
echo -n "${pathparts[key]}/"
fi
done
}
printline() {
local print
for index in ${!show[@]}
@ -129,11 +141,34 @@ printline() {
'oldtimestamp')
info=$(printDate ${!info})
;;
'path')
while [[ $path =~ / ]]
do
pathparts+=("${path%%/*}")
path=${path#*/}
done
pathparts+=("$path")
info=$(printPath)
unset oldpathparts
for key in ${!pathparts[@]}
do
oldpathparts[key]=${pathparts[key]}
done
unset pathparts
;;
*)
info="${!info}"
;;
esac
printtmp="${info:0:$locallength}"
if [ -z "$printtmp" ]
then
until (( ${#printtmp} == locallength/2))
do
printtmp+=' '
done
printtmp+='-'
fi
until (( ${#printtmp} == locallength ))
do
printtmp+=' '