config-fish/functions/upto.fish
2022-04-22 16:19:39 +02:00

13 lines
311 B
Fish

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