Added in check for existing module
This commit is contained in:
parent
ed5a879a4e
commit
ccc9974963
17
tdd.sh
17
tdd.sh
|
@ -14,9 +14,25 @@ clear_cmake_cache () {
|
||||||
rm -rf CMakeCache.txt CMakeFiles/
|
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 () {
|
add_new_module () {
|
||||||
read -p "Enter the name of the module:" modname
|
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')
|
modname_cap=$(echo $modname | sed 's/[a-z]/\U&/g')
|
||||||
modsrc_dir="./src/${modname}"
|
modsrc_dir="./src/${modname}"
|
||||||
modtest_dir="./tests/${modname}"
|
modtest_dir="./tests/${modname}"
|
||||||
|
@ -41,7 +57,6 @@ add_new_module () {
|
||||||
|
|
||||||
# Now we add the new files to the git tracked files
|
# Now we add the new files to the git tracked files
|
||||||
|
|
||||||
|
|
||||||
del_module
|
del_module
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue