add upto
This commit is contained in:
parent
da454a7247
commit
ef2965d319
4 changed files with 17 additions and 1 deletions
13
functions/upto.fish
Normal file
13
functions/upto.fish
Normal file
|
@ -0,0 +1,13 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue