@@ -32,32 +32,35 @@ def main() -> None:
3232 help = "PostgreSQL connection URL (e.g., postgresql://user:password@host:port/dbname)" ,
3333)
3434def start (
35- use_example : bool ,
36- no_ui : bool ,
35+ use_example : bool = False ,
36+ no_ui : bool = False ,
3737 from_yaml : str | None = None ,
3838 db_url : str | None = None ,
3939) -> None :
4040 """Start the FastAPI Forge server and generate a new project."""
41- if sum ([use_example , bool (from_yaml ), bool (db_url )]) > 1 :
41+ option_count = sum ([use_example , bool (from_yaml ), bool (db_url )])
42+ if option_count > 1 :
4243 msg = "Only one of '--use-example', '--from-yaml', or '--db-url' can be used."
4344 raise click .UsageError (msg )
4445
46+ if no_ui and option_count < 1 :
47+ msg = "Option '--no-ui' requires one of '--use-example', '--from-yaml', or '--db-url' to be set."
48+ raise click .UsageError (msg )
49+
4550 project_spec = None
4651
4752 if from_yaml :
4853 yaml_path = Path (from_yaml ).expanduser ().resolve ()
4954 if not yaml_path .is_file ():
5055 raise click .FileError (f"YAML file not found: { yaml_path } " )
5156 project_spec = ProjectLoader (project_path = yaml_path ).load_project_input ()
52-
5357 elif db_url :
5458 project_spec = ProjectLoader .load_project_spec_from_db (
5559 connection_string = db_url ,
5660 )
57-
58- else :
61+ elif use_example :
5962 base_path = Path (__file__ ).parent / "example-projects"
60- path = base_path / ( "game_zone.yaml" if use_example else "empty-service.yaml" )
63+ path = base_path / "game_zone.yaml"
6164 project_spec = ProjectLoader (project_path = path ).load_project_input ()
6265
6366 init (project_spec = project_spec , no_ui = no_ui )
0 commit comments