added new menu option that allows deleting code modules

This commit is contained in:
jakeg00dwin 2024-03-01 11:30:14 -08:00
parent c430835855
commit a6acbbd3f6
3 changed files with 33 additions and 18 deletions

37
otto.sh
View File

@ -27,8 +27,31 @@ does_module_exist () {
add_module_to_cmakes () {
local basename="$1"
cat "add_subdirectory(${basename})" >> ./src/CmakeLists.txt
cat "add_subdirectory(${basename})" >> ./tests/CmakeLists.txt
echo "add_subdirectory(${basename})" >> ./src/CMakeLists.txt
echo "add_subdirectory(${basename})" >> ./tests/CMakeLists.txt
}
remove_module_from_cmakes () {
local basename="$1"
sed "s/^.*add_subdirectory(${basename}).*$//g" ./src/CMakeLists.txt > ./src/CMakeLists.txt
sed "s/^.*add_subdirectory(${basename}).*$//g" ./tests/CMakeLists.txt > ./tests/CMakeLists.txt
}
git_add_module () {
# Now we add the new files to the git tracked files
git add ${modsrc_dir}/*
git add ${modsrc_dir}
git add ${modtest_dir}/*
git add ${modtest_dir}
git add ./src/CMakeLists.txt
git add ./tests/CMakeLists.txt
}
git_remove_module () {
}
add_new_module () {
@ -76,7 +99,6 @@ add_new_module () {
git add ./tests/CMakeLists.txt
del_module
}
del_module () {
@ -84,6 +106,7 @@ del_module () {
rm -r ./tests/${modname}
rm -r ./src/${modname}
remove_module_from_cmakes "${modname}"
}
cross_compile () {
@ -117,7 +140,8 @@ print_menu () {
echo "3. Build for release"
echo "4. cross compile for XXXXXX"
echo "5. Add new module to project"
echo "6. Exit"
echo "6. Delete module from project"
echo "7. Exit"
}
@ -155,6 +179,11 @@ main() {
add_new_module
;;
6)
echo "You selected Option 6"
valid_choice=true
del_module
;;
7)
echo "Exiting..."
exit 0
;;

View File

@ -1,12 +0,0 @@
add_executable(main PUBLIC
main.c
)
set_target_properties(main PROPERTIES VERSION 1.0 SOVERSION 1)
target_include_directories(main PUBLIC
${PROJECT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}
)
add_subdirectory(wrap)
add_subdirectory(led_driver)

View File

@ -1,2 +0,0 @@
add_subdirectory(simple_test)
add_subdirectory(wrap)