Преглед изворни кода

feat: Simplify optional variable preview display

- Show all optional variables in a single line
- Use dim white formatting for subtle display
- More compact and cleaner output
- Example: 'service_port_https: 8443, container_name: nginx, service_port_http: 8080'
xcad пре 6 месеци
родитељ
комит
acd39b5ff3
2 измењених фајлова са 18 додато и 7 уклоњено
  1. 17 6
      cli/core/prompt.py
  2. 1 1
      library/compose/nginx/compose.yaml

+ 17 - 6
cli/core/prompt.py

@@ -122,26 +122,37 @@ class SimplifiedPromptHandler:
     
     # Process optional variables
     if optional:
-      console.print(f"\n[bold cyan]{display_name} - Optional Configuration[/bold cyan]")
       # Filter out enabler variables from display
       display_optional = [v for v in optional if v != enabler]
       if display_optional:
-        self._show_variables(display_optional)
+        console.print(f"\n[bold cyan]{display_name} - Optional Configuration[/bold cyan]")
+        self._show_variables_inline(display_optional)
       
-      if Confirm.ask("Do you want to change any values?", default=False):
+      if display_optional and Confirm.ask("Do you want to change any values?", default=False):
         for var_name in optional:
           var = self.variables[var_name]
           self.values[var_name] = self._prompt_variable(
             var, current_value=self.values[var_name]
           )
   
-  def _show_variables(self, var_names: List[str]):
-    """Display current variable values."""
+  def _show_variables_inline(self, var_names: List[str]):
+    """Display current variable values in a single line."""
+    items = []
     for var_name in var_names:
       var = self.variables[var_name]
       value = self.values.get(var_name, var.default)
       if value is not None:
-        console.print(f"  {var.display_name}: [dim]{value}[/dim]")
+        # Format value based on type
+        if isinstance(value, bool):
+          formatted_value = str(value).lower()
+        elif isinstance(value, str) and ' ' in value:
+          formatted_value = f"'{value}'"
+        else:
+          formatted_value = str(value)
+        items.append(f"{var.display_name}: {formatted_value}")
+    
+    if items:
+      console.print(f"  [dim white]{', '.join(items)}[/dim white]")
   
   def _prompt_variable(
     self, 

+ 1 - 1
library/compose/nginx/compose.yaml

@@ -34,7 +34,7 @@ services:
       - "{{ service_port_http | default(8080) }}:80"
       - "{{ service_port_https | default(8443) }}:443"
       {% if nginx_dashboard %}
-      - "{{ nginx_dashboard_port_dashboard | default(8081) }}:8080"
+      - "{{ nginx_dashboard.port | default(8081) }}:8080"
       {% endif %}
     {% endif %}
     # volumes: