Factory function to create best available display.
(
group: "RunningProcessGroup", display_type: str = "auto"
)
| 375 | |
| 376 | |
| 377 | def create_status_display( |
| 378 | group: "RunningProcessGroup", display_type: str = "auto" |
| 379 | ) -> ProcessStatusDisplay: |
| 380 | """Factory function to create best available display.""" |
| 381 | |
| 382 | if display_type == "auto": |
| 383 | config = get_display_format() |
| 384 | display_type = config.format_type |
| 385 | |
| 386 | if display_type == "rich": |
| 387 | try: |
| 388 | return RichStatusDisplay(group) |
| 389 | except KeyboardInterrupt as ki: |
| 390 | handle_keyboard_interrupt(ki) |
| 391 | raise |
| 392 | except Exception as e: |
| 393 | logger.warning(f"Rich display creation failed, falling back to ASCII: {e}") |
| 394 | return ASCIIStatusDisplay(group) |
| 395 | |
| 396 | # Default to ASCII |
| 397 | return ASCIIStatusDisplay(group) |
| 398 | |
| 399 | |
| 400 | def display_process_status( |
no test coverage detected