Skip to content

Commit 9b31b4e

Browse files
committed
Update moduleCreator script to support new repository structure
1 parent 4ade7a8 commit 9b31b4e

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

moduleCreator.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
from datetime import date
33

44

5-
def create_module_structure(module_name):
5+
def create_module_structure(base_category, module_name):
66
today = date.today().isoformat()
77

88
# Format names
9-
root_dir = module_name
9+
root_dir = os.path.join(base_category, module_name)
1010
module_dir = os.path.join(root_dir, module_name)
1111
examples_dir = os.path.join(module_dir, "Examples")
1212

@@ -37,17 +37,34 @@ def create_module_structure(module_name):
3737
with open(example_file, "w") as f:
3838
f.write(example_content)
3939

40-
print(f"\n✅ Created module structure for '{module_name}':")
40+
print(f"\nCreated module structure for '{module_name}' in category '{base_category}':")
4141
print(f" - {module_file}")
4242
print(f" - {example_file}")
4343

4444

4545
if __name__ == "__main__":
46+
categories = {
47+
"1": "Sensors",
48+
"2": "Actuators",
49+
"3": "Communication",
50+
"4": "Displays"
51+
}
52+
4653
try:
47-
module_name = input("Enter the module name: ").strip()
48-
if not module_name:
49-
print("❌ Module name cannot be empty.")
54+
print("Select a category for the module:")
55+
for key, name in categories.items():
56+
print(f" {key}. {name}")
57+
58+
choice = input("Enter the number corresponding to the category: ").strip()
59+
base_category = categories.get(choice)
60+
61+
if not base_category:
62+
print("Invalid category selection.")
5063
else:
51-
create_module_structure(module_name)
64+
module_name = input("Enter the module name: ").strip()
65+
if not module_name:
66+
print("Module name cannot be empty.")
67+
else:
68+
create_module_structure(base_category, module_name)
5269
except Exception as e:
53-
print(f"Error: {e}")
70+
print(f"Error: {e}")

0 commit comments

Comments
 (0)