From e169dcb8b944d7679d245cb9a67a5fe0c56f9c37 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Tue, 17 Jun 2025 12:26:20 +0200 Subject: Add upto script --- fish/functions/upto.fish | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 fish/functions/upto.fish (limited to 'fish') diff --git a/fish/functions/upto.fish b/fish/functions/upto.fish new file mode 100644 index 0000000..7a9f40d --- /dev/null +++ b/fish/functions/upto.fish @@ -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 -- cgit v1.2.3