about summary refs log tree commit diff
path: root/tools/depot-scanner/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/depot-scanner/main.go')
-rw-r--r--tools/depot-scanner/main.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/depot-scanner/main.go b/tools/depot-scanner/main.go
index 8d69981c0d7e..273190258958 100644
--- a/tools/depot-scanner/main.go
+++ b/tools/depot-scanner/main.go
@@ -18,6 +18,7 @@ var nixStoreRoot = flag.String("store-path", "/nix/store/", "prefix for all vali
 
 var modeFlag = flag.String("mode", modeArchive, "operation mode. valid values: tar, print")
 var onlyFlag = flag.String("only", "", "only enable the listed output types, comma separated. valid values: DEPOT, STORE, CORE, UNKNOWN")
+var relativeFlag = flag.Bool("relpath", false, "when printing paths, print them relative to the root of their path type")
 
 const (
 	modeArchive = "tar"
@@ -164,16 +165,25 @@ func main() {
 	if *modeFlag == "print" {
 		if enabledPathTypes[pb.PathType_STORE] {
 			for k, _ := range results[nixStorePath] {
+				if *relativePath {
+					k = strings.TrimPrefix(k, *nixStoreRoot)
+					k = strings.TrimPrefix(k, "/")
+				}
 				fmt.Println(k)
 			}
 		}
 		if enabledPathTypes[pb.PathType_DEPOT] {
 			for k, _ := range results[depotPath] {
+				if *relativeFlag {
+					k = strings.TrimPrefix(k, *depotRoot)
+					k = strings.TrimPrefix(k, "/")
+				}
 				fmt.Println(k)
 			}
 		}
 		if enabledPathTypes[pb.PathType_CORE] {
 			for k, _ := range results[corePkgsPath] {
+				// TODO relativeFlag
 				fmt.Println(k)
 			}
 		}