imag/scripts/check-binary-names
Matthias Beyer 2fa5b2f4bd Add script to check whether binaries are named correctly
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>
2018-08-26 04:24:57 +02:00

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