Added in check for existing module

This commit is contained in:
jakeg00dwin 2024-03-01 00:06:14 -08:00
parent ed5a879a4e
commit ccc9974963
1 changed files with 17 additions and 2 deletions

19
tdd.sh
View File

@ -14,9 +14,25 @@ clear_cmake_cache () {
rm -rf CMakeCache.txt CMakeFiles/
}
does_moule_exist () {
local basename="$1"
if [ -d "tests/$basename"] || [ -d "src/$basename" ]; then
return 1
else
return 0
fi
}
add_new_module () {
read -p "Enter the name of the module:" modname
if does_module_exist $modname; then
echo "Module already exists!"
echo "Exiting without changing anything"
exit
fi
modname_cap=$(echo $modname | sed 's/[a-z]/\U&/g')
modsrc_dir="./src/${modname}"
modtest_dir="./tests/${modname}"
@ -41,7 +57,6 @@ add_new_module () {
# Now we add the new files to the git tracked files
del_module
}