Matthias Beyer
2fa5b2f4bd
It is a simple approach but it works: Read the name of the binary from the Cargo.toml file and check whether the name appears in the path. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
14 lines
404 B
Bash
14 lines
404 B
Bash
#!/usr/bin/env bash
|
|
|
|
for file in `find bin -type f -name Cargo.toml -o -name main.rs -o -name ui.rs`;
|
|
do
|
|
echo "$file" | grep Cargo.toml > /dev/null 2>/dev/null && {
|
|
name=$(cat $file | grep description | sed 's,.*: ,,; s, .*,,')
|
|
|
|
echo "$file" | grep "$name" > /dev/null 2>/dev/null || {
|
|
echo "Crate in $file is named $name"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
done
|