|
2 | 2 | from datetime import date |
3 | 3 |
|
4 | 4 |
|
5 | | -def create_module_structure(module_name): |
| 5 | +def create_module_structure(base_category, module_name): |
6 | 6 | today = date.today().isoformat() |
7 | 7 |
|
8 | 8 | # Format names |
9 | | - root_dir = module_name |
| 9 | + root_dir = os.path.join(base_category, module_name) |
10 | 10 | module_dir = os.path.join(root_dir, module_name) |
11 | 11 | examples_dir = os.path.join(module_dir, "Examples") |
12 | 12 |
|
@@ -37,17 +37,34 @@ def create_module_structure(module_name): |
37 | 37 | with open(example_file, "w") as f: |
38 | 38 | f.write(example_content) |
39 | 39 |
|
40 | | - print(f"\n✅ Created module structure for '{module_name}':") |
| 40 | + print(f"\nCreated module structure for '{module_name}' in category '{base_category}':") |
41 | 41 | print(f" - {module_file}") |
42 | 42 | print(f" - {example_file}") |
43 | 43 |
|
44 | 44 |
|
45 | 45 | if __name__ == "__main__": |
| 46 | + categories = { |
| 47 | + "1": "Sensors", |
| 48 | + "2": "Actuators", |
| 49 | + "3": "Communication", |
| 50 | + "4": "Displays" |
| 51 | + } |
| 52 | + |
46 | 53 | 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.") |
50 | 63 | 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) |
52 | 69 | except Exception as e: |
53 | | - print(f"❌ Error: {e}") |
| 70 | + print(f"Error: {e}") |
0 commit comments