re-factored to use a function for adding new modules to git tracking.

This commit is contained in:
jakeg00dwin 2024-03-02 11:04:29 -08:00
parent 2149dbd671
commit 84e3385105
1 changed files with 18 additions and 0 deletions

18
otto.sh
View File

@ -9,11 +9,13 @@ CROSS_COMPILE=1
TEMPLATE_FILES=".template_files" TEMPLATE_FILES=".template_files"
MODULE_DIR="${TEMPLATE_FILES}/modules" MODULE_DIR="${TEMPLATE_FILES}/modules"
clear_cmake_cache () { clear_cmake_cache () {
cd ./build cd ./build
rm -rf CMakeCache.txt CMakeFiles/ rm -rf CMakeCache.txt CMakeFiles/
} }
does_module_exist () { does_module_exist () {
local basename="$1" local basename="$1"
@ -24,6 +26,7 @@ does_module_exist () {
fi fi
} }
add_module_to_cmakes () { add_module_to_cmakes () {
local basename="$1" local basename="$1"
@ -40,6 +43,16 @@ remove_module_from_cmakes () {
git_add_module () { git_add_module () {
local basename="$1"
read -p "Auto add to git?(y/n):" CHOICE
if [ "${CHOICE}" -eq "n" ]; then
echo "not being added!"
return 0
fi
modsrc_dir="./src/${basename}"
modtest_dir="./tests/${basename}"
# Now we add the new files to the git tracked files # Now we add the new files to the git tracked files
git add ${modsrc_dir}/* git add ${modsrc_dir}/*
@ -50,10 +63,12 @@ git_add_module () {
git add ./tests/CMakeLists.txt git add ./tests/CMakeLists.txt
} }
git_remove_module () { git_remove_module () {
echo "unfinished" echo "unfinished"
} }
add_new_module () { add_new_module () {
read -p "Enter the name of the module:" modname read -p "Enter the name of the module:" modname
@ -91,9 +106,12 @@ add_new_module () {
tree -L 2 $modtest_dir tree -L 2 $modtest_dir
# Now we add the new files to the git tracked files # Now we add the new files to the git tracked files
git_add_module "${modname}"
} }
del_module () { del_module () {
read -p "Enter the name of the module:" modname read -p "Enter the name of the module:" modname