summary refs log tree commit diff
path: root/bin/find-rust-target-dir
blob: b59a2b46f327197bd4e23c4cdd41ce0f0abc9b90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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}