Skip to content

Commit c349d9e

Browse files
committed
Update new_component.py.
- Adapting to the new directory structure.
1 parent 6cbdf1b commit c349d9e

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ FUNCTION(capitalize IN OUT)
9292
ENDFUNCTION()
9393

9494
SET(COMPONENTS
95-
calc::abs
96-
calc::add
9795
base::baseConvert
98-
calc::subtract
99-
calc::multiply
10096
base::decimalConvert
97+
calc::abs
98+
calc::add
99+
calc::atan2
101100
calc::comparison
102-
calc::power
103101
calc::division
104-
calc::root
105102
calc::factorial
106-
calc::trig
107103
calc::hyp
108104
calc::log
109-
calc::atan2
105+
calc::multiply
106+
calc::power
107+
calc::root
108+
calc::subtract
109+
calc::trig
110110
)
111111
# NEW_COMPONENT: PATCH Do NOT remove the previous comment.
112112

tools/new_component.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ def make_dir(name: str, date: str, author: str) -> None:
139139
:param date: The date of creation.
140140
:param author: The author of the component.
141141
"""
142-
path: Path = SRC_DIR / name
142+
143+
parts = name.split("::")
144+
if len(parts) != 2:
145+
print("ERROR: Name format is incorrect. Should be a::b.")
146+
origin = parts[0]
147+
name = parts[1]
148+
path: Path = SRC_DIR / origin / name
143149

144150
if not path.is_dir():
145151
path.mkdir(exist_ok=False)
@@ -185,10 +191,13 @@ def make_dir(name: str, date: str, author: str) -> None:
185191
#include "{name}Report.hpp"
186192
#include <string>
187193
188-
std::string {name}(/* Arguments... */)
194+
namespace steppable::__internals::arithmetic
189195
{BRACE}
190-
// Your code here...
191-
{END_BRACE}
196+
std::string {name}(/* Arguments... */)
197+
{BRACE}
198+
// Your code here...
199+
{END_BRACE}
200+
{END_BRACE} // namespace steppable::__internals::arithmetic
192201
"""
193202
)
194203
print(f"- Added {name}.cpp")

0 commit comments

Comments
 (0)