mirror of
https://github.com/ChristianLempa/boilerplates.git
synced 2026-09-28 01:45:53 -04:00
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'
This commit is contained in:
+17
-6
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user