summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2016-04-11 22:16:37 +0300
committerBen Hilburn <bhilburn@gmail.com>2016-04-11 22:16:37 +0300
commitaec9d95295ef3966b835455c3340aa5f8b9367d9 (patch)
treed5b84dc5c71ebebe9322a2ea87a24d1c4049f8bd /functions
parentb6e8e20b65a9242e22c1e72a60e1bfa35c03f6e3 (diff)
parent4ca6938801daf7158edc3b8e1922aa748d07eb18 (diff)
Merge pull request #229 from alexlafroscia/add-package-name-shortening-strategy
Add shortening strategy based on package.json name
Diffstat (limited to 'functions')
-rw-r--r--functions/utilities.zsh6
1 files changed, 6 insertions, 0 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 5ca5b431..eed6ccc5 100644
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -186,3 +186,9 @@ function segmentShouldBeJoined() {
return 1
fi
}
+
+# Given a directory path, truncate it according to the settings for
+# `truncate_from_right`
+function truncatePathFromRight() {
+ echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\//g"
+}