From 451cfcf020a6816c1f34f8e12c4d296c52cd31fa Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Mon, 11 Nov 2024 08:20:32 +0100 Subject: [PATCH] Create up.fish --- up.fish | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 up.fish diff --git a/up.fish b/up.fish new file mode 100644 index 0000000..bbf49b3 --- /dev/null +++ b/up.fish @@ -0,0 +1,15 @@ +function up + if test (count $argv) -eq 0 + cd .. + return + end + + if test $argv[1] = / + cd / + return + end + + # Emulate the same logic of trimming the PWD + set -l target (string replace -r ".*/$argv[1]" "" $PWD) + cd $PWD[1..- (string length -- $target)] +end