Terminal UI API¶
ui
¶
Professional, lightly pirate-themed terminal presentation for Maraudarr.
UserCancelled
¶
Bases: RuntimeError
Represent an intentional cancellation rather than a generator failure.
UI
¶
Render Maraudarr output consistently in rich and plain terminals.
Rich presentation is used only when optional dependencies are available, styled output is allowed, and the caller did not request plain mode.
Attributes:
| Name | Type | Description |
|---|---|---|
plain |
Whether output uses dependency-free text presentation. |
|
console |
Rich console instance, or |
Create a terminal presenter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plain
|
bool
|
Force dependency-free output even when Rich is available.
The |
False
|
Source code in docker/src/maraudarr/ui.py
welcome
¶
Display Maraudarr's purpose before listing available choices.
Source code in docker/src/maraudarr/ui.py
show_presets
¶
List presets with their exact default services.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
presets
|
list[Preset]
|
Presets to display in caller-supplied order. |
required |
service_lookup
|
dict[str, Service]
|
Service metadata keyed by catalog identifier. |
required |
Source code in docker/src/maraudarr/ui.py
choose_preset
¶
choose_preset(presets: list[Preset]) -> str
Prompt for one preset in an interactive terminal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
presets
|
list[Preset]
|
Ordered choices presented to the user. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Stable identifier of the selected preset. |
Raises:
| Type | Description |
|---|---|
UserCancelled
|
If no interactive terminal is available or the user exits without choosing a preset. |
Source code in docker/src/maraudarr/ui.py
show_service_choices
¶
show_service_choices(services: list[Service]) -> None
Explain selectable services before interactive checkbox prompts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
services
|
list[Service]
|
Selectable services in desired presentation order. |
required |
Source code in docker/src/maraudarr/ui.py
choose_services
¶
choose_services(
services: list[Service], selected: set[str]
) -> set[str]
Collect service choices grouped by category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
services
|
list[Service]
|
Selectable services in category and presentation order. |
required |
selected
|
set[str]
|
Service IDs checked when each category prompt opens. |
required |
Returns:
| Type | Description |
|---|---|
set[str]
|
Service IDs checked across every category. |
Raises:
| Type | Description |
|---|---|
UserCancelled
|
If no interactive terminal is available or the user exits any category prompt. |
Source code in docker/src/maraudarr/ui.py
show_plan
¶
show_plan(plan: StackPlan) -> None
Present the resolved service manifest before writing files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
StackPlan
|
Fully resolved stack plan, including automatic dependencies. |
required |
Source code in docker/src/maraudarr/ui.py
confirm
¶
Confirm a plan when attached to an interactive terminal.
Returns:
| Type | Description |
|---|---|
bool
|
|
Raises:
| Type | Description |
|---|---|
UserCancelled
|
If the user dismisses the confirmation prompt. |
Source code in docker/src/maraudarr/ui.py
progress
¶
Print one generation progress message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
User-facing status text to display unchanged. |
required |
success
¶
success(
plan: StackPlan,
compose_path: str,
env_path: str,
config_path: str,
) -> None
Report generated artifacts and context-aware launch instructions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
StackPlan
|
Generated plan used to select relevant follow-up steps. |
required |
compose_path
|
str
|
Display path to the generated Compose chart. |
required |
env_path
|
str
|
Display path to the generated environment file. |
required |
config_path
|
str
|
Display path to the generated config root. |
required |
Source code in docker/src/maraudarr/ui.py
error
¶
Display a generator failure and optional corrective action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Concrete failure explanation. |
required |
fix
|
str | None
|
Optional next action that may correct the failure. |
None
|
Source code in docker/src/maraudarr/ui.py
cancelled
¶
Display an intentional cancellation without reporting failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Cancellation reason to present to the user. |
required |