fix(app): --display CLI flag now takes priority over preset
The --display CLI flag wasn't being checked, so it was always using the preset's display backend. Now app.py checks if --display was provided and uses it if present, otherwise falls back to the preset's display setting. Example: uv run mainline.py --preset border-test --display websocket # Now correctly uses websocket instead of terminal (border-test default)
This commit is contained in:
@@ -110,9 +110,17 @@ def run_pipeline_mode(preset_name: str = "demo"):
|
|||||||
|
|
||||||
print(f" \033[38;5;82mLoaded {len(items)} items\033[0m")
|
print(f" \033[38;5;82mLoaded {len(items)} items\033[0m")
|
||||||
|
|
||||||
display = DisplayRegistry.create(preset.display)
|
# CLI --display flag takes priority over preset
|
||||||
|
# Check if --display was explicitly provided
|
||||||
|
display_name = preset.display
|
||||||
|
if "--display" in sys.argv:
|
||||||
|
idx = sys.argv.index("--display")
|
||||||
|
if idx + 1 < len(sys.argv):
|
||||||
|
display_name = sys.argv[idx + 1]
|
||||||
|
|
||||||
|
display = DisplayRegistry.create(display_name)
|
||||||
if not display:
|
if not display:
|
||||||
print(f" \033[38;5;196mFailed to create display: {preset.display}\033[0m")
|
print(f" \033[38;5;196mFailed to create display: {display_name}\033[0m")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
display.init(80, 24)
|
display.init(80, 24)
|
||||||
@@ -166,7 +174,7 @@ def run_pipeline_mode(preset_name: str = "demo"):
|
|||||||
f"effect_{effect_name}", create_stage_from_effect(effect, effect_name)
|
f"effect_{effect_name}", create_stage_from_effect(effect, effect_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
pipeline.add_stage("display", create_stage_from_display(display, preset.display))
|
pipeline.add_stage("display", create_stage_from_display(display, display_name))
|
||||||
|
|
||||||
pipeline.build()
|
pipeline.build()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user