33"""
44
55from pathlib import Path
6- from typing import Optional
76
87from fletx .cli .commands import TemplateCommand , CommandParser
98from fletx .utils .exceptions import CommandExecutionError
@@ -20,7 +19,7 @@ def add_arguments(self, parser: CommandParser) -> None:
2019 """Add arguments specific to the component command."""
2120 parser .add_argument (
2221 "type" ,
23- choices = ["controller" , "service" , "model" , " component" , "page" , "middleware" , "guard" ],
22+ choices = ["controller" , "service" , "component" , "page" , "middleware" , "guard" ],
2423 help = "Type of component to generate"
2524 )
2625 parser .add_argument (
@@ -137,7 +136,7 @@ def _get_default_template(self, component_type: str) -> str:
137136 template_mapping = {
138137 "controller" : "controller" ,
139138 "service" : "service" ,
140- "model" : "model" ,
139+ # "model": "model",
141140 "component" : "component" ,
142141 "page" : "page" ,
143142 "middleware" : "middleware" ,
@@ -153,7 +152,7 @@ def _get_default_output_dir(self, component_type: str) -> str:
153152 dir_mapping = {
154153 "controller" : "app/controllers" ,
155154 "service" : "app/services" ,
156- "model" : "app/models" ,
155+ # "model": "app/models",
157156 "component" : "app/components" ,
158157 "page" : "app/pages" ,
159158 "middleware" : "app/middlewares" ,
@@ -242,48 +241,48 @@ def _print_usage_instructions(
242241 "controller" : [
243242 f"1. Your controller is located at: { target_dir } /{ name .lower ()} _controller.py" ,
244243 f"2. Add your business logic in the { name } Controller class" ,
245- f "3. Use dependency injection to access services" ,
246- f "4. Register the controller in your bindings if needed"
244+ "3. Use dependency injection to access services" ,
245+ "4. Register the controller in your bindings if needed"
247246 ],
248247 "service" : [
249248 f"1. Your service is located at: { target_dir } /{ name .lower ()} _service.py" ,
250249 f"2. Implement your business logic in the { name } Service class" ,
251- f "3. Register the service in your bindings" ,
252- f "4. Inject the service into controllers that need it"
250+ "3. Register the service in your bindings" ,
251+ "4. Inject the service into controllers that need it"
253252 ],
254253 "model" : [
255254 f"1. Your model is located at: { target_dir } /{ name .lower ()} _model.py" ,
256255 f"2. Define your data structure in the { name } Model class" ,
257- f "3. Add validation and serialization methods as needed" ,
258- f "4. Use the model in your controllers and services"
256+ "3. Add validation and serialization methods as needed" ,
257+ "4. Use the model in your controllers and services"
259258 ],
260259 "component" : [
261260 f"1. Your widget is located at: { target_dir } /{ name .lower ()} _component.py" ,
262261 f"2. Implement your custom widget in the { name } Widget class" ,
263- f "3. Use the widget in your views and pages" ,
264- f "4. Make it reusable by parameterizing it properly"
262+ "3. Use the widget in your views and pages" ,
263+ "4. Make it reusable by parameterizing it properly"
265264 ],
266265 "page" : [
267266 f"1. Your page is located at: { target_dir } /{ name .lower ()} _page.py" ,
268267 f"2. Define your page layout in the { name } Page class" ,
269- f "3. Add the page to your route configuration" ,
270- f "4. Connect to controllers for business logic"
268+ "3. Add the page to your route configuration" ,
269+ "4. Connect to controllers for business logic"
271270 ]
272271 }
273272
274273 component_instructions = instructions .get (component_type , [
275274 f"1. Your component is located at: { target_dir } " ,
276275 f"2. Customize the { name } class as needed" ,
277- f "3. Follow FletX patterns and conventions"
276+ "3. Follow FletX patterns and conventions"
278277 ])
279278
280279 for instruction in component_instructions :
281280 print (f" { instruction } " )
282281
283- print (f "\n Next steps:" )
284- print (f " • Edit the generated files to implement your logic" )
285- print (f " • Run your application with: fletx run" )
286- print (f " • Check the documentation for best practices" )
282+ print ("\n Next steps:" )
283+ print (" • Edit the generated files to implement your logic" )
284+ print (" • Run your application with: fletx run" )
285+ print (" • Check the documentation for best practices" )
287286
288287 def get_missing_args_message (self ) -> str :
289288 """Get the missing arguments message."""
0 commit comments