config-fish/functions/upto.fish

14 lines
311 B
Fish
Raw Normal View History

2022-04-22 14:19:39 +00:00
function upto -a where -d "Go up to a certain directory"
set -l pieces ( pwd | tr "/" "\n")
if contains -- $where $pieces
set -l p (contains --index -- $where $pieces)
set -l dest (printf "%s\n" $pieces[1..$p] | tr "\n" "/")
cd "$dest"
return
end
return 1
end