diff --git a/tdd.sh b/tdd.sh index 787889c..7c922c6 100755 --- a/tdd.sh +++ b/tdd.sh @@ -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 }