Bläddra i källkod

Merge branch 'main' into add-validation-to-function-vars

Khaleel Al-Adhami 6 månader sedan
förälder
incheckning
1e9743dcd6
2 ändrade filer med 8 tillägg och 3 borttagningar
  1. 3 2
      reflex/reflex.py
  2. 5 1
      reflex/utils/prerequisites.py

+ 3 - 2
reflex/reflex.py

@@ -106,7 +106,7 @@ def _init(
         template = constants.Templates.DEFAULT
         template = constants.Templates.DEFAULT
 
 
     # Initialize the app.
     # Initialize the app.
-    prerequisites.initialize_app(app_name, template)
+    template = prerequisites.initialize_app(app_name, template)
 
 
     # If a reflex.build generation hash is available, download the code and apply it to the main module.
     # If a reflex.build generation hash is available, download the code and apply it to the main module.
     if generation_hash:
     if generation_hash:
@@ -120,8 +120,9 @@ def _init(
     # Initialize the requirements.txt.
     # Initialize the requirements.txt.
     prerequisites.initialize_requirements_txt()
     prerequisites.initialize_requirements_txt()
 
 
+    template_msg = "" if template else f" using the {template} template"
     # Finish initializing the app.
     # Finish initializing the app.
-    console.success(f"Initialized {app_name}")
+    console.success(f"Initialized {app_name}{template_msg}")
 
 
 
 
 @cli.command()
 @cli.command()

+ 5 - 1
reflex/utils/prerequisites.py

@@ -1378,7 +1378,7 @@ def create_config_init_app_from_remote_template(app_name: str, template_url: str
     shutil.rmtree(unzip_dir)
     shutil.rmtree(unzip_dir)
 
 
 
 
-def initialize_app(app_name: str, template: str | None = None):
+def initialize_app(app_name: str, template: str | None = None) -> str | None:
     """Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
     """Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
 
 
     Args:
     Args:
@@ -1387,6 +1387,9 @@ def initialize_app(app_name: str, template: str | None = None):
 
 
     Raises:
     Raises:
         Exit: If template is directly provided in the command flag and is invalid.
         Exit: If template is directly provided in the command flag and is invalid.
+
+    Returns:
+        The name of the template.
     """
     """
     # Local imports to avoid circular imports.
     # Local imports to avoid circular imports.
     from reflex.utils import telemetry
     from reflex.utils import telemetry
@@ -1441,6 +1444,7 @@ def initialize_app(app_name: str, template: str | None = None):
         )
         )
 
 
     telemetry.send("init", template=template)
     telemetry.send("init", template=template)
+    return template
 
 
 
 
 def initialize_main_module_index_from_generation(app_name: str, generation_hash: str):
 def initialize_main_module_index_from_generation(app_name: str, generation_hash: str):