Skip to content

Commit

Permalink
Update new_component.py.
Browse files Browse the repository at this point in the history
- Adapting to the new directory structure.
  • Loading branch information
ZCG-coder committed Aug 9, 2024
1 parent 6cbdf1b commit c349d9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,21 @@ FUNCTION(capitalize IN OUT)
ENDFUNCTION()

SET(COMPONENTS
calc::abs
calc::add
base::baseConvert
calc::subtract
calc::multiply
base::decimalConvert
calc::abs
calc::add
calc::atan2
calc::comparison
calc::power
calc::division
calc::root
calc::factorial
calc::trig
calc::hyp
calc::log
calc::atan2
calc::multiply
calc::power
calc::root
calc::subtract
calc::trig
)
# NEW_COMPONENT: PATCH Do NOT remove the previous comment.

Expand Down
17 changes: 13 additions & 4 deletions tools/new_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ def make_dir(name: str, date: str, author: str) -> None:
:param date: The date of creation.
:param author: The author of the component.
"""
path: Path = SRC_DIR / name

parts = name.split("::")
if len(parts) != 2:
print("ERROR: Name format is incorrect. Should be a::b.")
origin = parts[0]
name = parts[1]
path: Path = SRC_DIR / origin / name

if not path.is_dir():
path.mkdir(exist_ok=False)
Expand Down Expand Up @@ -185,10 +191,13 @@ def make_dir(name: str, date: str, author: str) -> None:
#include "{name}Report.hpp"
#include <string>
std::string {name}(/* Arguments... */)
namespace steppable::__internals::arithmetic
{BRACE}
// Your code here...
{END_BRACE}
std::string {name}(/* Arguments... */)
{BRACE}
// Your code here...
{END_BRACE}
{END_BRACE} // namespace steppable::__internals::arithmetic
"""
)
print(f"- Added {name}.cpp")
Expand Down

0 comments on commit c349d9e

Please sign in to comment.