blob: ce88c92d1ee595a1aa5e02158a6301a28002082d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#
# Truncate directory
#
function __sf_util_truncate_dir -a path truncate_to -d "Truncate a directory path"
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
|