shithub: x

Download patch

ref: 147c0127fb766de457fe12d0b66f23cd17c028cc
parent: 7b56396f68019f1027bad077fe4a5b600d609f3e
author: kvik <kvik@a-b.xyz>
date: Mon Sep 2 05:35:14 EDT 2019

x/path: don't hardcode /x/ rooted paths

--- a/path
+++ b/path
@@ -5,16 +5,14 @@
 	wd=$$#*
 if not
 	wd=`{pwd}
-if(! ~ $wd /x/*)
-	exit notinx
 for(arg){
 	switch($arg){
 	case -P
-		echo $wd | sed 's,/x/[^/]+(.*),\1,'
+		echo $wd | sed 's,/[^/]+/[^/]+(.*),\1,'
 	case -p
-		echo $wd | sed 's,/x/[^/]+/(.*),\1,'
+		echo $wd | sed 's,/[^/]+/[^/]+/(.*),\1,'
 	case -r
-		echo $wd | sed 's,(/x/[^/]+).*,\1,'
+		echo $wd | sed 's,(/[^/]+/[^/]+).*,\1,'
 	case -l
 		echo $wd | awk -F/ '{print $3}'
 	}