Start the spinner with the given message. No-op if the spinner is already running. Fails silently if the console cannot support live display. Args: message: Status text to display next to the spinner.
(self, message: str = "Working...")
| 123 | self._live: Live | None = None |
| 124 | |
| 125 | def start(self, message: str = "Working...") -> None: |
| 126 | """Start the spinner with the given message. |
| 127 | |
| 128 | No-op if the spinner is already running. Fails silently if the console |
| 129 | cannot support live display. |
| 130 | |
| 131 | Args: |
| 132 | message: Status text to display next to the spinner. |
| 133 | """ |
| 134 | if self._live is not None: |
| 135 | return |
| 136 | renderable = RichSpinner( |
| 137 | "dots", |
| 138 | text=Text(f" {message}", style="dim"), |
| 139 | style="dim", |
| 140 | ) |
| 141 | try: |
| 142 | self._live = Live(renderable, console=self._console, transient=True) |
| 143 | self._live.start() |
| 144 | except (AttributeError, TypeError, OSError) as exc: |
| 145 | logger.warning("Spinner start failed: %s", exc) |
| 146 | self._live = None |
| 147 | |
| 148 | def stop(self) -> None: |
| 149 | """Stop the spinner if running. Can be restarted with `start`.""" |
no outgoing calls
no test coverage detected