summaryrefslogtreecommitdiff
path: root/functions/utilities.zsh
diff options
context:
space:
mode:
authorChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-22 21:33:43 +0300
committerChristo Kotze <onaforeignshore@hotmail.co.uk>2018-02-22 21:33:43 +0300
commit2bd3e0f67ee8c4f78cbcf20b6c5c391650ebf5c8 (patch)
tree9b375d2523483ec31e7dd11d25e8130080e2b19e /functions/utilities.zsh
parentec0f7bdacbd2be5214588ca7c0b63f8b2697e2fd (diff)
Fixed silly coding error
Did `local 3=...` instead of `3=...`
Diffstat (limited to 'functions/utilities.zsh')
-rw-r--r--functions/utilities.zsh8
1 files changed, 3 insertions, 5 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 1b2035ac..b4173b99 100644
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -226,7 +226,7 @@ function truncatePath() {
# convert $2 from string to integer
2=$(( $2 ))
# set $3 to "" if not defined
- [[ -z $3 ]] && local 3="" || 3=$(echo -n $3)
+ [[ -z $3 ]] && 3="" || 3=$(echo -n $3)
# set $4 to "right" if not defined
[[ -z $4 ]] && 4="right"
# create a variable for the truncated path.
@@ -237,14 +237,12 @@ function truncatePath() {
local paths=$1
paths=(${(s:/:)${paths//"~\/"/}})
# declare locals for the directory being tested and its length
- local test_dir test_dir_length delim_len
+ local test_dir test_dir_length
# do the needed truncation
case $4 in
right)
- # check the length of the delimiter
- [[ -z $3 ]] && delim_len=${#3} || delim_len=0
# include the delimiter length in the threshhold
- local threshhold=$(( $2 + $delim_len ))
+ local threshhold=$(( $2 + ${#3} ))
# loop through the paths
for (( i=1; i<${#paths}; i++ )); do
# get the current directory value