shithub: mc

Download patch

ref: 2d4241c939e10e96105a9d5db549dffae6e8e413
parent: cfc5ff6b83b8b7f1556debbaff2dd9dda1e23581
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 23 10:28:12 EDT 2014

Add function to clean only one target.

--- a/clean.myr
+++ b/clean.myr
@@ -7,7 +7,7 @@
 
 pkg bld =
 	const cleanall	: (p : parser# -> bool)
-	/*const clean	: (p : parser#, targ : byte[:] -> bool)*/
+	const clean	: (p : parser#, targ : byte[:] -> bool)
 ;;
 
 const cleanall = {p
@@ -17,6 +17,24 @@
 			cleanup(bin, leaves, true)
 		| `Lib (lib, leaves):
 			cleanup(lib, leaves, true)
+		| `Sub subs:
+		| `Man m:
+		;;
+	;;
+	-> true
+}
+
+const clean = {p, targ
+	for t in p.targs
+		match t
+		| `Bin (bin, leaves):
+			if std.sleq(bin, targ)
+				cleanup(bin, leaves, true)
+			;;
+		| `Lib (lib, leaves):
+			if std.sleq(lib, targ)
+				cleanup(lib, leaves, true)
+			;;
 		| `Sub subs:
 		| `Man m:
 		;;