summary refs log tree commit diff
path: root/bin/find-rust-target-dir
diff options
context:
space:
mode:
Diffstat (limited to 'bin/find-rust-target-dir')
-rwxr-xr-xbin/find-rust-target-dir16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/find-rust-target-dir b/bin/find-rust-target-dir
new file mode 100755
index 0000000..b59a2b4
--- /dev/null
+++ b/bin/find-rust-target-dir
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+is_rust_root() {
+    [ -f $1/Cargo.toml ] || return 1
+    [ -d $1/target ] || return 1
+    return 0
+}
+
+inspect() {
+    for dir in `fd -t d -d 1 '' "${1}"`; do
+        is_rust_root ${dir} && { echo ${dir}; du -h -d 0; echo -e "\n"; continue; }
+        inspect ${dir}
+    done
+}
+
+inspect ${1:-$PWD}