Fix docs panel text wrapping: remove hardcoded line breaks

Let Rich handle word wrapping naturally instead of breaking lines
at fixed widths, which caused mid-word cuts in narrow panels.
Also use NoMatches instead of bare Exception in toggle handler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shuki
2026-03-06 23:41:36 +02:00
parent b28146529e
commit 5ea4bea00a

View File

@@ -5,24 +5,17 @@ SCREEN_DOCS = {
"Run backups of configured targets to remote destinations.\n"
"\n"
"[bold]Fields:[/bold]\n"
" [bold]Target[/bold] - The backup target to run. Each target\n"
" defines which folders and databases to back up.\n"
" [bold]Target[/bold] - The backup target to run. Each target defines which folders and databases to back up.\n"
"\n"
" [bold]Remote[/bold] - Where to send the backup. Choose a\n"
" specific remote or 'Default (all)' to back up to\n"
" every configured remote.\n"
" [bold]Remote[/bold] - Where to send the backup. Choose a specific remote or 'Default (all)' to back up to every configured remote.\n"
"\n"
"[bold]Buttons:[/bold]\n"
" [bold]Run Backup[/bold] - Back up the selected target to\n"
" the selected remote.\n"
" [bold]Backup All[/bold] - Back up all enabled targets to\n"
" all their configured remotes.\n"
" [bold]Run Backup[/bold] - Back up the selected target to the selected remote.\n"
" [bold]Backup All[/bold] - Back up all enabled targets to all their configured remotes.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - Backups run in the background. You can monitor\n"
" progress on the Running Tasks screen.\n"
" - Each backup creates a timestamped snapshot on\n"
" the remote, so you can restore any point in time.\n"
" - Backups run in the background. You can monitor progress on the Running Tasks screen.\n"
" - Each backup creates a timestamped snapshot on the remote, so you can restore any point in time.\n"
" - Use retention cleanup to remove old snapshots."
),
"restore-screen": (
@@ -33,27 +26,17 @@ SCREEN_DOCS = {
"[bold]Fields:[/bold]\n"
" [bold]Target[/bold] - The backup target to restore.\n"
" [bold]Remote[/bold] - The remote that holds the snapshot.\n"
" [bold]Snapshot[/bold] - The specific point-in-time snapshot\n"
" to restore from. Loaded after selecting target and\n"
" remote.\n"
" [bold]Restore location[/bold] - Choose 'In-place' to\n"
" overwrite original files, or 'Custom directory' to\n"
" restore to a different path.\n"
" [bold]Restore MySQL[/bold] - Toggle whether to restore\n"
" MySQL databases (only shown if the target has MySQL\n"
" backup enabled).\n"
" [bold]Snapshot[/bold] - The specific point-in-time snapshot to restore from. Loaded after selecting target and remote.\n"
" [bold]Restore location[/bold] - Choose 'In-place' to overwrite original files, or 'Custom directory' to restore to a different path.\n"
" [bold]Restore MySQL[/bold] - Toggle whether to restore MySQL databases (only shown if the target has MySQL backup enabled).\n"
"\n"
"[bold]Warning:[/bold]\n"
" In-place restore will overwrite existing files.\n"
" Consider restoring to a custom directory first to\n"
" verify the contents."
" In-place restore will overwrite existing files. Consider restoring to a custom directory first to verify the contents."
),
"targets-screen": (
"[bold]Targets Screen[/bold]\n"
"\n"
"List and manage backup targets. A target defines what\n"
"to back up: folders, file patterns, and optionally\n"
"MySQL databases.\n"
"List and manage backup targets. A target defines what to back up: folders, file patterns, and optionally MySQL databases.\n"
"\n"
"[bold]Table columns:[/bold]\n"
" [bold]Name[/bold] - Unique target identifier.\n"
@@ -66,10 +49,8 @@ SCREEN_DOCS = {
" [bold]Delete[/bold] - Remove the selected target.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - You need at least one target and one remote\n"
" before you can run backups.\n"
" - Disable a target to skip it during 'Backup All'\n"
" without deleting it."
" - You need at least one target and one remote before you can run backups.\n"
" - Disable a target to skip it during 'Backup All' without deleting it."
),
"target-edit": (
"[bold]Target Editor[/bold]\n"
@@ -77,22 +58,15 @@ SCREEN_DOCS = {
"Add or edit a backup target configuration.\n"
"\n"
"[bold]Fields:[/bold]\n"
" [bold]Name[/bold] - Unique identifier (letters, digits,\n"
" dash, underscore; max 32 chars).\n"
" [bold]Folders[/bold] - Comma-separated paths to back up.\n"
" Use Browse to pick folders interactively.\n"
" [bold]Include/Exclude[/bold] - Glob patterns to filter\n"
" files (e.g. *.conf, *.log).\n"
" [bold]Remote override[/bold] - Force this target to a\n"
" specific remote instead of the default.\n"
" [bold]Name[/bold] - Unique identifier (letters, digits, dash, underscore; max 32 chars).\n"
" [bold]Folders[/bold] - Comma-separated paths to back up. Use Browse to pick folders interactively.\n"
" [bold]Include/Exclude[/bold] - Glob patterns to filter files (e.g. *.conf, *.log).\n"
" [bold]Remote override[/bold] - Force this target to a specific remote instead of the default.\n"
" [bold]Retention override[/bold] - Custom snapshot count.\n"
" [bold]Pre/Post hooks[/bold] - Shell commands to run\n"
" before/after the backup.\n"
" [bold]Pre/Post hooks[/bold] - Shell commands to run before/after the backup.\n"
"\n"
"[bold]MySQL section:[/bold]\n"
" Enable MySQL to dump databases alongside files.\n"
" Choose 'All databases' or select specific ones.\n"
" Leave user/password empty for socket auth."
" Enable MySQL to dump databases alongside files. Choose 'All databases' or select specific ones. Leave user/password empty for socket auth."
),
"remotes-screen": (
"[bold]Remotes Screen[/bold]\n"
@@ -101,8 +75,7 @@ SCREEN_DOCS = {
"\n"
"[bold]Table columns:[/bold]\n"
" [bold]Name[/bold] - Unique remote identifier.\n"
" [bold]Type[/bold] - Connection type (SSH, Local, S3,\n"
" Google Drive).\n"
" [bold]Type[/bold] - Connection type (SSH, Local, S3, Google Drive).\n"
" [bold]Host/Path[/bold] - Connection details.\n"
" [bold]Disk[/bold] - Available space (loaded in background).\n"
"\n"
@@ -114,8 +87,7 @@ SCREEN_DOCS = {
"\n"
"[bold]Tips:[/bold]\n"
" - Always test a new remote before running backups.\n"
" - The Disk column shows used/total space and may\n"
" take a moment to load for SSH remotes."
" - The Disk column shows used/total space and may take a moment to load for SSH remotes."
),
"remote-edit": (
"[bold]Remote Editor[/bold]\n"
@@ -126,23 +98,18 @@ SCREEN_DOCS = {
" [bold]SSH[/bold] - Remote server via SSH/rsync.\n"
" [bold]Local[/bold] - Local directory or mounted drive.\n"
" [bold]S3[/bold] - Amazon S3 or compatible storage.\n"
" [bold]Google Drive[/bold] - Google Drive via service\n"
" account.\n"
" [bold]Google Drive[/bold] - Google Drive via service account.\n"
"\n"
"[bold]SSH fields:[/bold]\n"
" Host, port, user, and either SSH key or password\n"
" authentication.\n"
" Host, port, user, and either SSH key or password authentication.\n"
"\n"
"[bold]Common fields:[/bold]\n"
" [bold]Base path[/bold] - Root directory for backups on\n"
" the remote.\n"
" [bold]Bandwidth limit[/bold] - Throttle transfer speed\n"
" in KB/s (0 = unlimited).\n"
" [bold]Base path[/bold] - Root directory for backups on the remote.\n"
" [bold]Bandwidth limit[/bold] - Throttle transfer speed in KB/s (0 = unlimited).\n"
" [bold]Retention count[/bold] - Max snapshots to keep.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - For SSH, ensure the remote user has write access\n"
" to the base path.\n"
" - For SSH, ensure the remote user has write access to the base path.\n"
" - Use key-based auth for unattended backups."
),
"snapshots-screen": (
@@ -155,17 +122,13 @@ SCREEN_DOCS = {
" [bold]Remote[/bold] - The remote holding snapshots.\n"
"\n"
"[bold]Buttons:[/bold]\n"
" [bold]Load Snapshots[/bold] - Fetch the list of\n"
" available snapshots from the remote.\n"
" [bold]Browse Files[/bold] - View the file tree inside\n"
" the selected snapshot.\n"
" [bold]Load Snapshots[/bold] - Fetch the list of available snapshots from the remote.\n"
" [bold]Browse Files[/bold] - View the file tree inside the selected snapshot.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - Each snapshot is a timestamped directory on the\n"
" remote containing the backed-up files.\n"
" - Each snapshot is a timestamped directory on the remote containing the backed-up files.\n"
" - Loading may take a moment for SSH remotes.\n"
" - Use the Restore screen to actually restore files\n"
" from a snapshot."
" - Use the Restore screen to actually restore files from a snapshot."
),
"retention-screen": (
"[bold]Retention Cleanup[/bold]\n"
@@ -174,20 +137,15 @@ SCREEN_DOCS = {
"\n"
"[bold]Fields:[/bold]\n"
" [bold]Target[/bold] - Run cleanup for a specific target.\n"
" [bold]Default retention count[/bold] - Number of\n"
" snapshots to keep per target/remote pair.\n"
" [bold]Default retention count[/bold] - Number of snapshots to keep per target/remote pair.\n"
"\n"
"[bold]Buttons:[/bold]\n"
" [bold]Run Cleanup[/bold] - Clean old snapshots for the\n"
" selected target.\n"
" [bold]Cleanup All[/bold] - Clean old snapshots for all\n"
" targets.\n"
" [bold]Run Cleanup[/bold] - Clean old snapshots for the selected target.\n"
" [bold]Cleanup All[/bold] - Clean old snapshots for all targets.\n"
" [bold]Save[/bold] - Save the default retention count.\n"
"\n"
"[bold]How it works:[/bold]\n"
" Retention keeps the N most recent snapshots and\n"
" deletes the rest. Per-target or per-remote overrides\n"
" take priority over the default count.\n"
" Retention keeps the N most recent snapshots and deletes the rest. Per-target or per-remote overrides take priority over the default count.\n"
"\n"
"[bold]Warning:[/bold]\n"
" Deleted snapshots cannot be recovered."
@@ -200,8 +158,7 @@ SCREEN_DOCS = {
"[bold]Table columns:[/bold]\n"
" [bold]Name[/bold] - Schedule identifier.\n"
" [bold]Active[/bold] - Whether the schedule is enabled.\n"
" [bold]Type[/bold] - Frequency (hourly/daily/weekly/\n"
" monthly/custom).\n"
" [bold]Type[/bold] - Frequency (hourly/daily/weekly/monthly/custom).\n"
" [bold]Time[/bold] - When the backup runs.\n"
" [bold]Last/Next Run[/bold] - Timing information.\n"
" [bold]Targets/Remotes[/bold] - Scope of the schedule.\n"
@@ -211,8 +168,7 @@ SCREEN_DOCS = {
" [bold]Show crontab[/bold] - View the installed crontab.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - The cron daemon must be running for schedules to\n"
" execute. You will be warned if it is not running.\n"
" - The cron daemon must be running for schedules to execute. You will be warned if it is not running.\n"
" - Changes are automatically synced to crontab."
),
"schedule-edit": (
@@ -225,19 +181,15 @@ SCREEN_DOCS = {
" [bold]Daily[/bold] - Run at a set time on selected days.\n"
" [bold]Weekly[/bold] - Run once a week on a chosen day.\n"
" [bold]Monthly[/bold] - Run once a month on a chosen day.\n"
" [bold]Custom cron[/bold] - Use a raw 5-field cron\n"
" expression for full control.\n"
" [bold]Custom cron[/bold] - Use a raw 5-field cron expression for full control.\n"
"\n"
"[bold]Fields:[/bold]\n"
" [bold]Time[/bold] - The time of day to run (HH:MM).\n"
" [bold]Targets[/bold] - Which targets to back up. Leave\n"
" empty to back up all targets.\n"
" [bold]Remotes[/bold] - Which remotes to use. Leave empty\n"
" to use all remotes.\n"
" [bold]Targets[/bold] - Which targets to back up. Leave empty to back up all targets.\n"
" [bold]Remotes[/bold] - Which remotes to use. Leave empty to use all remotes.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - Daily schedules let you pick specific days of\n"
" the week.\n"
" - Daily schedules let you pick specific days of the week.\n"
" - Custom cron: minute hour day month weekday"
),
"logs-screen": (
@@ -246,27 +198,22 @@ SCREEN_DOCS = {
"View backup operation logs.\n"
"\n"
"[bold]Table columns:[/bold]\n"
" [bold]Status[/bold] - Outcome (Success, Failed,\n"
" Interrupted, Empty).\n"
" [bold]Status[/bold] - Outcome (Success, Failed, Interrupted, Empty).\n"
" [bold]Date/Time[/bold] - When the operation ran.\n"
" [bold]Size[/bold] - Log file size.\n"
"\n"
"[bold]Buttons:[/bold]\n"
" [bold]View[/bold] - Display the selected log file\n"
" contents in the viewer below.\n"
" [bold]Status[/bold] - Show a summary of recent backup\n"
" activity.\n"
" [bold]View[/bold] - Display the selected log file contents in the viewer below.\n"
" [bold]Status[/bold] - Show a summary of recent backup activity.\n"
"\n"
"[bold]Status detection:[/bold]\n"
" - [green]Success[/green] - 'Backup completed' found, no errors.\n"
" - [red]Failed[/red] - ERROR or FATAL entries found.\n"
" - [yellow]Interrupted[/yellow] - Log exists but backup did\n"
" not complete.\n"
" - [yellow]Interrupted[/yellow] - Log exists but backup did not complete.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - The 20 most recent logs are shown.\n"
" - Check logs after scheduled backups to verify\n"
" they ran successfully."
" - Check logs after scheduled backups to verify they ran successfully."
),
"settings-screen": (
"[bold]Settings Screen[/bold]\n"
@@ -276,16 +223,12 @@ SCREEN_DOCS = {
"[bold]General:[/bold]\n"
" [bold]Log Level[/bold] - Verbosity of log output.\n"
" [bold]Log Retention[/bold] - Days to keep log files.\n"
" [bold]Retention Count[/bold] - Default number of\n"
" snapshots to keep.\n"
" [bold]Bandwidth Limit[/bold] - Default transfer speed\n"
" limit in KB/s.\n"
" [bold]Disk Threshold[/bold] - Warn when remote disk\n"
" usage exceeds this percentage.\n"
" [bold]Retention Count[/bold] - Default number of snapshots to keep.\n"
" [bold]Bandwidth Limit[/bold] - Default transfer speed limit in KB/s.\n"
" [bold]Disk Threshold[/bold] - Warn when remote disk usage exceeds this percentage.\n"
"\n"
"[bold]Email Notifications:[/bold]\n"
" Configure SMTP to receive email alerts on backup\n"
" success or failure.\n"
" Configure SMTP to receive email alerts on backup success or failure.\n"
"\n"
"[bold]SSH:[/bold]\n"
" [bold]Timeout[/bold] - Seconds before SSH gives up.\n"
@@ -295,8 +238,7 @@ SCREEN_DOCS = {
" Port, host, and API key for the web interface.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - Per-target and per-remote settings override\n"
" these defaults."
" - Per-target and per-remote settings override these defaults."
),
"running-tasks-screen": (
"[bold]Running Tasks[/bold]\n"
@@ -304,25 +246,19 @@ SCREEN_DOCS = {
"Monitor running backup and restore jobs.\n"
"\n"
"[bold]Table columns:[/bold]\n"
" [bold]Status[/bold] - Current state (running, ok, failed,\n"
" unknown).\n"
" [bold]Status[/bold] - Current state (running, ok, failed, unknown).\n"
" [bold]Job[/bold] - Description of the operation.\n"
" [bold]Started[/bold] - When the job began.\n"
" [bold]Duration[/bold] - Elapsed time.\n"
"\n"
"[bold]Buttons:[/bold]\n"
" [bold]View Log[/bold] - Show live log output and\n"
" progress bar for the selected job.\n"
" [bold]Kill Job[/bold] - Terminate the selected running\n"
" job.\n"
" [bold]Clear Finished[/bold] - Remove completed jobs\n"
" from the list.\n"
" [bold]View Log[/bold] - Show live log output and progress bar for the selected job.\n"
" [bold]Kill Job[/bold] - Terminate the selected running job.\n"
" [bold]Clear Finished[/bold] - Remove completed jobs from the list.\n"
"\n"
"[bold]Tips:[/bold]\n"
" - The table refreshes every second.\n"
" - The progress bar shows rsync transfer progress\n"
" when viewing a running job's log.\n"
" - Jobs continue in the background even if you\n"
" navigate away from this screen."
" - The progress bar shows rsync transfer progress when viewing a running job's log.\n"
" - Jobs continue in the background even if you navigate away from this screen."
),
}