This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
matchai
committed
Feb 6, 2018
1 parent
96a0f60
commit 5a6b489
Showing
2 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function __sf_util_truncate_dir -d "Truncate a directory path" -a path truncate_to | ||
if test $truncate_to -eq 0 | ||
echo $path | ||
else | ||
set -l folders (string split / $path) | ||
|
||
if test (count $folders) -le $truncate_to | ||
echo $path | ||
else | ||
echo (string join / $folders[(math 0 - $truncate_to)..-1]) | ||
end | ||
end | ||
end |