From a6acbbd3f6946f338efd76927f6313d9e9e9c6f3 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Fri, 1 Mar 2024 11:30:14 -0800 Subject: [PATCH] added new menu option that allows deleting code modules --- otto.sh | 37 +++++++++++++++++++++++++++++++++---- src/CMakeLists.txt | 12 ------------ tests/CMakeLists.txt | 2 -- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/otto.sh b/otto.sh index ce043f5..84078dc 100755 --- a/otto.sh +++ b/otto.sh @@ -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 ;; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 50e5749..e69de29 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 524ee31..e69de29 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,2 +0,0 @@ -add_subdirectory(simple_test) -add_subdirectory(wrap)