termux-sync 1.2.6__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {termux_sync-1.2.6 → termux_sync-1.3.0}/CHANGELOG.md +35 -1
- {termux_sync-1.2.6 → termux_sync-1.3.0}/PKG-INFO +1 -1
- {termux_sync-1.2.6 → termux_sync-1.3.0}/pyproject.toml +1 -1
- {termux_sync-1.2.6 → termux_sync-1.3.0}/src/termux_sync/__init__.py +565 -214
- {termux_sync-1.2.6 → termux_sync-1.3.0}/LICENSE +0 -0
- {termux_sync-1.2.6 → termux_sync-1.3.0}/README.md +0 -0
|
@@ -11,6 +11,40 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [1.3.0] - 2026-10-21
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- **Cleaner, phone-friendly output.** All progress bars now use a single non-wrapping line per task: the label is cut with "…" instead of pushing the bar and timer onto a second line.
|
|
18
|
+
- Backup picker (`restore`, `delete`) no longer overflows the screen. On narrow terminals each backup is shown as a compact two-line card (name, then date · packages · size · label); on wide terminals it stays a table, now with Size and Pkgs columns. The redundant "Storage" column was removed.
|
|
19
|
+
- `setup`: wrapped text keeps its indentation, the exclude-pattern list is shown as a short summary (full list only when you choose to edit it), and the compression hint is its own line.
|
|
20
|
+
- Summary panels (backup, restore, setup) are more compact and show short paths (`~/.config/...`).
|
|
21
|
+
- The `TERMUX` ASCII banner falls back to a one-line title on terminals too narrow to draw it.
|
|
22
|
+
- `restore` step 4 now shows which package is being installed (`12/496 git`) and reports how many could not be installed; failures are written to the log.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- **`restore` from GitHub flooded the screen.** Every downloaded part (25+) kept its own progress row, so the display grew taller than the screen and was drawn over itself. Downloads now use one overall progress bar (bytes, current part, elapsed time) that disappears when finished and is replaced by a single "Downloaded N files (size, time)" line.
|
|
26
|
+
- GitHub downloads are streamed to disk in blocks instead of being read fully into memory, and parts are joined without loading them into RAM. A full disk now stops immediately instead of retrying.
|
|
27
|
+
- `backup` to GitHub: finished upload rows no longer pile up in the progress display.
|
|
28
|
+
- Backups without a manifest no longer show their tag name as a duplicate "Label".
|
|
29
|
+
|
|
30
|
+
### Security
|
|
31
|
+
- `setup` no longer prints a saved GitHub token back to the screen when you re-run it (the default value is hidden).
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [1.2.8] - 2026-10-15
|
|
36
|
+
|
|
37
|
+
## Fixed
|
|
38
|
+
- `status` tables fit narrow phone screens: long paths are shortened (`$PREFIX/bin/tar`, `~/.config/...`), the ✓/✗ sits in its own column, and `rclone` is shown as "not needed" unless Google Drive is the selected storage.
|
|
39
|
+
- **GitHub backups no longer need room for the whole archive.** The archive is streamed and uploaded in 200 MB parts, each deleted right after it is sent (before, the full archive *plus* a split copy were written to disk, which caused "No space left on device"). The backup format is unchanged, so `restore` works as before. Needs about 250 MB free.
|
|
40
|
+
- Upload retry logic: permanent HTTP errors (bad token, etc.) now stop immediately instead of retrying for minutes; "already uploaded" (422) is handled again.
|
|
41
|
+
- Running out of disk space during `backup` stops with a clear message instead of continuing with a broken backup.
|
|
42
|
+
- `backup` to GitHub now checks the repository (token, name, not empty) *before* the long archive step, instead of failing after the archive is built.
|
|
43
|
+
- GitHub API errors are shown as short readable messages (e.g. "repository is empty") instead of raw JSON.
|
|
44
|
+
- If an upload fails, the finished archives are kept in the temp folder instead of being deleted.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
14
48
|
## [1.2.6] - 2026-10-15
|
|
15
49
|
|
|
16
50
|
### Changed
|
|
@@ -22,7 +56,7 @@ Version numbers follow [Semantic Versioning](https://semver.org/).
|
|
|
22
56
|
### Fixed
|
|
23
57
|
- Missing `rich` no longer causes a `NameError`; it is installed automatically on first run.
|
|
24
58
|
- Invalid "Max backups" input in `setup` no longer crashes.
|
|
25
|
-
- Error text containing square brackets can no longer break rich markup
|
|
59
|
+
- Error text containing square brackets can no longer break rich markup
|
|
26
60
|
|
|
27
61
|
---
|
|
28
62
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: termux-sync
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Backup and restore your entire Termux environment across devices
|
|
5
5
|
Project-URL: Homepage, https://github.com/djunekz/termux-sync
|
|
6
6
|
Project-URL: Repository, https://github.com/djunekz/termux-sync
|
|
@@ -34,7 +34,7 @@ try:
|
|
|
34
34
|
TextColumn, TimeElapsedColumn, FileSizeColumn,
|
|
35
35
|
TransferSpeedColumn, TaskProgressColumn,
|
|
36
36
|
)
|
|
37
|
-
from rich.table import Table
|
|
37
|
+
from rich.table import Table, Column
|
|
38
38
|
from rich.prompt import Prompt, Confirm
|
|
39
39
|
from rich.text import Text
|
|
40
40
|
from rich import box
|
|
@@ -60,7 +60,7 @@ except ImportError:
|
|
|
60
60
|
)
|
|
61
61
|
sys.exit(1)
|
|
62
62
|
|
|
63
|
-
VERSION = "1.
|
|
63
|
+
VERSION = "1.3.0"
|
|
64
64
|
APP_NAME = "termux-sync"
|
|
65
65
|
CONFIG_DIR = Path.home() / ".config" / APP_NAME
|
|
66
66
|
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
@@ -190,6 +190,8 @@ def _explain(exc: Exception) -> tuple:
|
|
|
190
190
|
import urllib.error
|
|
191
191
|
import socket
|
|
192
192
|
|
|
193
|
+
if isinstance(exc, StreamAbort): # upload failure while streaming
|
|
194
|
+
exc = exc.original
|
|
193
195
|
if isinstance(exc, UserError):
|
|
194
196
|
return exc.title, exc.message, exc.hint
|
|
195
197
|
if isinstance(exc, EOFError):
|
|
@@ -246,7 +248,7 @@ def handle_crash(exc: Exception):
|
|
|
246
248
|
|
|
247
249
|
console.print() # leave the half-finished prompt line
|
|
248
250
|
title, message, hint = _explain(exc)
|
|
249
|
-
expected = isinstance(exc, UserError)
|
|
251
|
+
expected = isinstance(getattr(exc, "original", exc), UserError)
|
|
250
252
|
print_error(title, message, hint, where="" if expected and not DEBUG else _origin(exc))
|
|
251
253
|
|
|
252
254
|
if DEBUG:
|
|
@@ -259,9 +261,15 @@ def handle_crash(exc: Exception):
|
|
|
259
261
|
|
|
260
262
|
|
|
261
263
|
def print_banner():
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
264
|
+
art_width = max(len(line) for line in BANNER.splitlines())
|
|
265
|
+
if console.width >= art_width + 2:
|
|
266
|
+
console.print(
|
|
267
|
+
Align.center(
|
|
268
|
+
f"[bold green]{BANNER}[/bold green]"))
|
|
269
|
+
else:
|
|
270
|
+
console.print()
|
|
271
|
+
console.print(Align.center("[bold green]T E R M U X - S Y N C[/bold green]"))
|
|
272
|
+
console.print()
|
|
265
273
|
console.print(
|
|
266
274
|
Align.center(
|
|
267
275
|
f"[dim]Version: [/dim][bold white]v{VERSION}[/bold white]\n"
|
|
@@ -273,11 +281,17 @@ def print_banner():
|
|
|
273
281
|
console.print()
|
|
274
282
|
|
|
275
283
|
|
|
284
|
+
def note(text: str, style: str = ""):
|
|
285
|
+
"""Print wrapped text with a 2-space margin on both sides, so lines that
|
|
286
|
+
wrap on a narrow screen stay aligned instead of jumping back to column 0."""
|
|
287
|
+
console.print(Padding(text, (0, 1, 0, 2)), style=style)
|
|
288
|
+
|
|
289
|
+
|
|
276
290
|
def print_section(title: str, subtitle: str = ""):
|
|
277
291
|
console.print()
|
|
278
|
-
console.print(Rule(f"[bold yellow]
|
|
292
|
+
console.print(Rule(f"[bold yellow]{title}[/bold yellow]", style="yellow dim"))
|
|
279
293
|
if subtitle:
|
|
280
|
-
|
|
294
|
+
note(f"[dim]{subtitle}[/dim]")
|
|
281
295
|
console.print()
|
|
282
296
|
|
|
283
297
|
|
|
@@ -285,6 +299,91 @@ def status_icon(ok: bool) -> str:
|
|
|
285
299
|
return "[bold green]✓[/bold green]" if ok else "[bold red]✗[/bold red]"
|
|
286
300
|
|
|
287
301
|
|
|
302
|
+
def is_narrow() -> bool:
|
|
303
|
+
"""True on phone-sized terminals (Termux portrait is ~45 columns)."""
|
|
304
|
+
return console.width < 72
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
def make_progress(transient: bool = False, percent: bool = False) -> Progress:
|
|
308
|
+
"""One-line-per-task progress display that never wraps.
|
|
309
|
+
|
|
310
|
+
The description column takes whatever width is left and is cut with "…"
|
|
311
|
+
instead of pushing the bar/time onto a second line on narrow screens."""
|
|
312
|
+
cols = [
|
|
313
|
+
SpinnerColumn(),
|
|
314
|
+
TextColumn(
|
|
315
|
+
"{task.description}",
|
|
316
|
+
table_column=Column(ratio=1, no_wrap=True, overflow="ellipsis"),
|
|
317
|
+
),
|
|
318
|
+
BarColumn(bar_width=10 if is_narrow() else 24),
|
|
319
|
+
]
|
|
320
|
+
if percent:
|
|
321
|
+
cols.append(TaskProgressColumn())
|
|
322
|
+
cols.append(TimeElapsedColumn())
|
|
323
|
+
return Progress(*cols, console=console, expand=True, transient=transient)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def fmt_elapsed(seconds: float) -> str:
|
|
327
|
+
seconds = int(seconds)
|
|
328
|
+
return f"{seconds // 3600}:{seconds % 3600 // 60:02d}:{seconds % 60:02d}"
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _backup_date(b: dict) -> str:
|
|
332
|
+
return str(b.get("date", "—"))[:16].replace("T", " ")
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _backup_label(b: dict) -> str:
|
|
336
|
+
label = b.get("label", "") or ""
|
|
337
|
+
return "" if label == b.get("name") else label
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _backup_size(b: dict) -> int:
|
|
341
|
+
return sum(v.get("size", 0) for v in (b.get("files") or {}).values())
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def print_backup_list(backups: list, title: str = "Available Backups"):
|
|
345
|
+
"""Numbered backup list. Table on wide terminals, 2-line cards on phones."""
|
|
346
|
+
if is_narrow():
|
|
347
|
+
console.print(f" [bold yellow]{title}[/bold yellow]\n")
|
|
348
|
+
for i, b in enumerate(backups, 1):
|
|
349
|
+
console.print(f" [bold cyan]{i:>2}[/bold cyan] [bold white]{escape(str(b.get('name', '—')))}[/bold white]")
|
|
350
|
+
bits = [f"[green]{_backup_date(b)}[/green]"]
|
|
351
|
+
if b.get("packages"):
|
|
352
|
+
bits.append(f"[cyan]{len(b['packages'])} pkgs[/cyan]")
|
|
353
|
+
if _backup_size(b):
|
|
354
|
+
bits.append(f"[blue]{human_size(_backup_size(b))}[/blue]")
|
|
355
|
+
if _backup_label(b):
|
|
356
|
+
bits.append(f"[yellow]{escape(_backup_label(b))}[/yellow]")
|
|
357
|
+
console.print(" " + " [dim]·[/dim] ".join(bits))
|
|
358
|
+
console.print()
|
|
359
|
+
return
|
|
360
|
+
|
|
361
|
+
table = Table(
|
|
362
|
+
box=box.ROUNDED,
|
|
363
|
+
title=f"[bold yellow]{title}[/bold yellow]",
|
|
364
|
+
show_header=True,
|
|
365
|
+
header_style="bold cyan",
|
|
366
|
+
padding=(0, 1),
|
|
367
|
+
)
|
|
368
|
+
table.add_column("#", style="dim", width=3, justify="right")
|
|
369
|
+
table.add_column("Name", style="bold white", no_wrap=True)
|
|
370
|
+
table.add_column("Date", style="green", no_wrap=True)
|
|
371
|
+
table.add_column("Pkgs", style="cyan", justify="right")
|
|
372
|
+
table.add_column("Size", style="blue", justify="right")
|
|
373
|
+
table.add_column("Label", style="yellow")
|
|
374
|
+
for i, b in enumerate(backups, 1):
|
|
375
|
+
table.add_row(
|
|
376
|
+
str(i),
|
|
377
|
+
escape(str(b.get("name", "—"))),
|
|
378
|
+
_backup_date(b),
|
|
379
|
+
str(len(b.get("packages", []))) if b.get("packages") else "—",
|
|
380
|
+
human_size(_backup_size(b)) if _backup_size(b) else "—",
|
|
381
|
+
escape(_backup_label(b)) or "—",
|
|
382
|
+
)
|
|
383
|
+
console.print(table)
|
|
384
|
+
console.print()
|
|
385
|
+
|
|
386
|
+
|
|
288
387
|
def human_size(size_bytes: int) -> str:
|
|
289
388
|
size_bytes = int(size_bytes)
|
|
290
389
|
for unit in ("B", "KB", "MB", "GB"):
|
|
@@ -318,27 +417,30 @@ def get_installed_packages() -> list[str]:
|
|
|
318
417
|
return []
|
|
319
418
|
|
|
320
419
|
|
|
321
|
-
def install_packages(pkg_list: list[str], console: Console):
|
|
420
|
+
def install_packages(pkg_list: list[str], console: Console) -> list[str]:
|
|
421
|
+
"""Reinstall packages one by one. Returns the names that failed."""
|
|
322
422
|
if not pkg_list:
|
|
323
423
|
console.print(" [yellow]No packages to install.[/yellow]")
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
) as progress:
|
|
332
|
-
task = progress.add_task("[cyan]Installing packages…", total=len(pkg_list))
|
|
333
|
-
for pkg in pkg_list:
|
|
424
|
+
return []
|
|
425
|
+
failed: list[str] = []
|
|
426
|
+
total = len(pkg_list)
|
|
427
|
+
with make_progress(transient=True, percent=True) as progress:
|
|
428
|
+
task = progress.add_task("[cyan]Installing…", total=total)
|
|
429
|
+
for i, pkg in enumerate(pkg_list, 1):
|
|
430
|
+
progress.update(task, description=f"[cyan]{i}/{total} {escape(pkg)}")
|
|
334
431
|
try:
|
|
335
432
|
subprocess.run(
|
|
336
433
|
["pkg", "install", "-y", pkg],
|
|
337
434
|
capture_output=True, check=True
|
|
338
435
|
)
|
|
339
436
|
except Exception:
|
|
340
|
-
|
|
437
|
+
failed.append(pkg)
|
|
341
438
|
progress.advance(task)
|
|
439
|
+
console.print(f" {status_icon(True)} Installed [bold green]{total - len(failed)}[/bold green] of {total} packages")
|
|
440
|
+
if failed:
|
|
441
|
+
console.print(f" [yellow]⚠ {len(failed)} package(s) could not be installed (see log).[/yellow]")
|
|
442
|
+
log("WARNING", "Packages failed to install: " + ", ".join(failed))
|
|
443
|
+
return failed
|
|
342
444
|
|
|
343
445
|
|
|
344
446
|
def create_archive(
|
|
@@ -348,7 +450,10 @@ def create_archive(
|
|
|
348
450
|
excludes: list[str],
|
|
349
451
|
label: str,
|
|
350
452
|
progress: Progress,
|
|
453
|
+
sink=None,
|
|
351
454
|
) -> Path:
|
|
455
|
+
"""Create a tar archive. With `sink` (a file-like object) the archive is streamed
|
|
456
|
+
into it and nothing is written to `archive_path`."""
|
|
352
457
|
valid_compressions = {"gz", "bz2", "xz"}
|
|
353
458
|
if compression not in valid_compressions:
|
|
354
459
|
compression = "gz"
|
|
@@ -366,6 +471,8 @@ def create_archive(
|
|
|
366
471
|
out = archive_path.parent / (stem + ext)
|
|
367
472
|
|
|
368
473
|
task = progress.add_task(f"[cyan]{label}", total=None)
|
|
474
|
+
if sink is not None and hasattr(sink, "attach"):
|
|
475
|
+
sink.attach(progress, task, label)
|
|
369
476
|
|
|
370
477
|
def _filter(tarinfo):
|
|
371
478
|
for pat in excludes:
|
|
@@ -405,7 +512,11 @@ def create_archive(
|
|
|
405
512
|
try:
|
|
406
513
|
if source_path.is_dir():
|
|
407
514
|
_unlock(source_path)
|
|
408
|
-
|
|
515
|
+
if sink is not None:
|
|
516
|
+
opened = tarfile.open(fileobj=sink, mode=f"w|{compression}")
|
|
517
|
+
else:
|
|
518
|
+
opened = tarfile.open(out, mode)
|
|
519
|
+
with opened as tf:
|
|
409
520
|
if source_path.is_dir():
|
|
410
521
|
tf.add(source_path, arcname=source_path.name, filter=_filter)
|
|
411
522
|
else:
|
|
@@ -684,8 +795,90 @@ class GitHubStorage:
|
|
|
684
795
|
return {}
|
|
685
796
|
return json.loads(body)
|
|
686
797
|
except urllib.error.HTTPError as e:
|
|
687
|
-
|
|
688
|
-
|
|
798
|
+
raise self._http_error(e.code, e.read().decode(errors="replace")) from e
|
|
799
|
+
|
|
800
|
+
def _http_error(self, code: int, raw: str) -> Exception:
|
|
801
|
+
"""Turn a GitHub API error response into a short, human-readable exception."""
|
|
802
|
+
try:
|
|
803
|
+
data = json.loads(raw)
|
|
804
|
+
msg = str(data.get("message", "")).strip()
|
|
805
|
+
extras = "; ".join(
|
|
806
|
+
str(x.get("message")) for x in data.get("errors", [])
|
|
807
|
+
if isinstance(x, dict) and x.get("message")
|
|
808
|
+
)
|
|
809
|
+
except Exception:
|
|
810
|
+
msg, extras = raw.strip()[:300], ""
|
|
811
|
+
blob = f"{msg} {extras}".lower()
|
|
812
|
+
|
|
813
|
+
if code in (409, 422) and "empty" in blob:
|
|
814
|
+
return UserError(
|
|
815
|
+
f"The repository '{self.repo}' has no commits yet, and GitHub cannot "
|
|
816
|
+
"create a release in an empty repository.",
|
|
817
|
+
hint="Open the repository on GitHub, click [bold]Add a README[/bold] (or create "
|
|
818
|
+
"any file) and commit it. Then run the command again.",
|
|
819
|
+
title="GitHub repository is empty",
|
|
820
|
+
)
|
|
821
|
+
if code == 401:
|
|
822
|
+
return UserError(
|
|
823
|
+
"GitHub rejected the token (bad credentials).",
|
|
824
|
+
hint="Create a new token with the [bold]repo[/bold] scope at "
|
|
825
|
+
"[cyan]https://github.com/settings/tokens[/cyan], then run "
|
|
826
|
+
"[bold]termux-sync setup[/bold].",
|
|
827
|
+
title="Invalid GitHub token",
|
|
828
|
+
)
|
|
829
|
+
if code == 403 and "rate limit" in blob:
|
|
830
|
+
return UserError(
|
|
831
|
+
"GitHub is limiting requests from this token for now.",
|
|
832
|
+
hint="Wait a few minutes and try again.",
|
|
833
|
+
title="GitHub rate limit reached",
|
|
834
|
+
)
|
|
835
|
+
if code == 403:
|
|
836
|
+
return UserError(
|
|
837
|
+
msg or "The token is not allowed to do this.",
|
|
838
|
+
hint="Make sure the token has the [bold]repo[/bold] scope and can write to this repository.",
|
|
839
|
+
title="GitHub denied access",
|
|
840
|
+
)
|
|
841
|
+
if code == 404:
|
|
842
|
+
return UserError(
|
|
843
|
+
f"Repository '{self.repo}' was not found, or the token cannot see it.",
|
|
844
|
+
hint="Check the spelling (owner/repo) in [bold]termux-sync setup[/bold]. "
|
|
845
|
+
"For a private repository the token needs the [bold]repo[/bold] scope.",
|
|
846
|
+
title="GitHub repository not found",
|
|
847
|
+
)
|
|
848
|
+
detail = ": ".join(x for x in (msg, extras) if x) or "no details"
|
|
849
|
+
return RuntimeError(f"GitHub API error {code}: {detail}")
|
|
850
|
+
|
|
851
|
+
def preflight(self):
|
|
852
|
+
"""Fail fast — before a long archive step — if the repo cannot hold a release."""
|
|
853
|
+
self._api("GET", f"/repos/{self.repo}") # token + repo name
|
|
854
|
+
self._api("GET", f"/repos/{self.repo}/commits?per_page=1") # 409 if empty
|
|
855
|
+
|
|
856
|
+
# ── streaming backup: parts are uploaded and deleted one by one ──
|
|
857
|
+
def begin_stream(self, backup_name: str, work_dir: Path):
|
|
858
|
+
work_dir.mkdir(parents=True, exist_ok=True)
|
|
859
|
+
need = int(self.CHUNK_SIZE * 1.2)
|
|
860
|
+
free = shutil.disk_usage(work_dir).free
|
|
861
|
+
if free < need:
|
|
862
|
+
raise UserError(
|
|
863
|
+
f"Only {human_size(free)} is free, but about {human_size(need)} is needed "
|
|
864
|
+
"to hold one upload part.",
|
|
865
|
+
hint="Free some space with [bold]termux-sync clear-cache[/bold], or remove "
|
|
866
|
+
"files you no longer need, then try again.",
|
|
867
|
+
title="Not enough free space",
|
|
868
|
+
)
|
|
869
|
+
release = self._get_release_by_tag(backup_name) or self._create_release(backup_name)
|
|
870
|
+
self._stream = {"release_id": release["id"], "work_dir": work_dir}
|
|
871
|
+
|
|
872
|
+
def stream_sink(self, base_name: str, progress: Progress):
|
|
873
|
+
return _PartWriter(self, self._stream["release_id"], base_name,
|
|
874
|
+
self._stream["work_dir"], progress)
|
|
875
|
+
|
|
876
|
+
def abort_stream(self, backup_name: str):
|
|
877
|
+
"""Best effort: remove a half-finished release so it never counts as a backup."""
|
|
878
|
+
try:
|
|
879
|
+
self.delete_backup(backup_name)
|
|
880
|
+
except Exception:
|
|
881
|
+
pass
|
|
689
882
|
|
|
690
883
|
def _push_file(self, local_path: Path, remote_path: str, message: str):
|
|
691
884
|
import base64
|
|
@@ -774,19 +967,28 @@ class GitHubStorage:
|
|
|
774
967
|
result = json.loads(resp.read())
|
|
775
968
|
progress.update(progress_task, completed=file_size)
|
|
776
969
|
return result
|
|
970
|
+
except urllib.error.HTTPError as e:
|
|
971
|
+
# (HTTPError is a URLError subclass, so it must be handled first)
|
|
972
|
+
body = e.read().decode(errors="replace")
|
|
973
|
+
if e.code == 422:
|
|
974
|
+
progress.update(progress_task, completed=file_size,
|
|
975
|
+
description=f"[yellow]{local_path.name} already uploaded, skipping")
|
|
976
|
+
return {}
|
|
977
|
+
if e.code >= 500 or e.code == 429: # temporary: retry
|
|
978
|
+
last_err = e
|
|
979
|
+
progress.update(progress_task,
|
|
980
|
+
description=f"[yellow]Retry {attempt+1}/{self.MAX_RETRIES} ({local_path.name})...")
|
|
981
|
+
_time.sleep(15 * (attempt + 1))
|
|
982
|
+
continue
|
|
983
|
+
raise self._http_error(e.code, body) from e # permanent: stop now
|
|
777
984
|
except (urllib.error.URLError, OSError, ConnectionError) as e:
|
|
985
|
+
if getattr(e, "errno", None) == errno.ENOSPC:
|
|
986
|
+
raise
|
|
778
987
|
last_err = e
|
|
779
988
|
wait = 15 * (attempt + 1)
|
|
780
989
|
progress.update(progress_task,
|
|
781
990
|
description=f"[yellow]Retry {attempt+1}/{self.MAX_RETRIES} ({local_path.name})...")
|
|
782
991
|
_time.sleep(wait)
|
|
783
|
-
except urllib.error.HTTPError as e:
|
|
784
|
-
body = e.read().decode()
|
|
785
|
-
if e.code == 422:
|
|
786
|
-
progress.update(progress_task, completed=file_size,
|
|
787
|
-
description=f"[yellow]{local_path.name} already uploaded, skipping")
|
|
788
|
-
return {}
|
|
789
|
-
raise RuntimeError(f"Asset upload failed {e.code}: {body}") from e
|
|
790
992
|
|
|
791
993
|
raise RuntimeError(
|
|
792
994
|
f"Failed to upload {local_path.name} after {self.MAX_RETRIES} attempts: {last_err}"
|
|
@@ -816,15 +1018,20 @@ class GitHubStorage:
|
|
|
816
1018
|
for chunk in chunks:
|
|
817
1019
|
if chunk.name in existing_assets:
|
|
818
1020
|
continue
|
|
1021
|
+
progress.update(task, total=None, completed=0,
|
|
1022
|
+
description=f"[cyan]Uploading {escape(chunk.name)}")
|
|
819
1023
|
asset_task = progress.add_task(
|
|
820
1024
|
f"[cyan]{chunk.name}...", total=chunk.stat().st_size
|
|
821
1025
|
)
|
|
822
|
-
|
|
823
|
-
|
|
1026
|
+
try:
|
|
1027
|
+
self._upload_one_asset(release_id, chunk, asset_task, progress)
|
|
1028
|
+
finally:
|
|
1029
|
+
progress.remove_task(asset_task)
|
|
824
1030
|
finally:
|
|
825
1031
|
shutil.rmtree(tmp_split, ignore_errors=True)
|
|
826
1032
|
|
|
827
|
-
progress.update(task,
|
|
1033
|
+
progress.update(task, total=1, completed=1,
|
|
1034
|
+
description="[green]Uploaded to GitHub Releases ✓")
|
|
828
1035
|
return release_url
|
|
829
1036
|
|
|
830
1037
|
def list_backups(self) -> list[dict]:
|
|
@@ -850,7 +1057,7 @@ class GitHubStorage:
|
|
|
850
1057
|
backups.append(manifest or {
|
|
851
1058
|
"name": tag,
|
|
852
1059
|
"date": rel.get("created_at", ""),
|
|
853
|
-
"label":
|
|
1060
|
+
"label": "",
|
|
854
1061
|
})
|
|
855
1062
|
return backups
|
|
856
1063
|
|
|
@@ -862,34 +1069,51 @@ class GitHubStorage:
|
|
|
862
1069
|
assets = sorted(release.get("assets", []), key=lambda a: a["name"])
|
|
863
1070
|
dest.mkdir(parents=True, exist_ok=True)
|
|
864
1071
|
|
|
865
|
-
|
|
1072
|
+
# One overall task (bytes) instead of one row per part: with ~25 parts the
|
|
1073
|
+
# old per-file rows were taller than the screen and the display fell apart.
|
|
1074
|
+
n_files = len(assets)
|
|
1075
|
+
total_bytes = sum(a.get("size", 0) for a in assets) or 1
|
|
1076
|
+
task = progress.add_task("[cyan]Downloading…", total=total_bytes)
|
|
1077
|
+
done_bytes = 0
|
|
866
1078
|
|
|
867
|
-
for asset in assets:
|
|
1079
|
+
for n, asset in enumerate(assets, 1):
|
|
868
1080
|
url = self._asset_url(asset["id"])
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1081
|
+
name = asset["name"]
|
|
1082
|
+
out = dest / name
|
|
1083
|
+
tag = f"{n}/{n_files}"
|
|
1084
|
+
shown = re.sub(r"\.tar\.(gz|bz2|xz)", "", name) if is_narrow() else name
|
|
872
1085
|
last_err = None
|
|
873
1086
|
for attempt in range(8):
|
|
1087
|
+
got = 0
|
|
874
1088
|
try:
|
|
875
1089
|
req = urllib.request.Request(url, headers=self._asset_headers())
|
|
876
|
-
with urllib.request.urlopen(req, timeout=120) as r:
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
1090
|
+
with urllib.request.urlopen(req, timeout=120) as r, open(out, "wb") as fh:
|
|
1091
|
+
while True:
|
|
1092
|
+
block = r.read(1 << 18)
|
|
1093
|
+
if not block:
|
|
1094
|
+
break
|
|
1095
|
+
fh.write(block)
|
|
1096
|
+
got += len(block)
|
|
1097
|
+
progress.update(
|
|
1098
|
+
task, completed=min(done_bytes + got, total_bytes),
|
|
1099
|
+
description=f"[cyan]{tag} {escape(shown)}",
|
|
1100
|
+
)
|
|
1101
|
+
done_bytes += got
|
|
881
1102
|
last_err = None
|
|
882
1103
|
break
|
|
883
1104
|
except Exception as e:
|
|
1105
|
+
if getattr(e, "errno", None) == errno.ENOSPC:
|
|
1106
|
+
raise
|
|
884
1107
|
last_err = e
|
|
885
|
-
progress.update(
|
|
886
|
-
|
|
1108
|
+
progress.update(
|
|
1109
|
+
task, completed=min(done_bytes, total_bytes),
|
|
1110
|
+
description=f"[yellow]{tag} retry {attempt+1}/8",
|
|
1111
|
+
)
|
|
887
1112
|
_time.sleep(15 * (attempt + 1))
|
|
888
1113
|
if last_err:
|
|
889
1114
|
raise RuntimeError(
|
|
890
|
-
f"Failed to download {
|
|
1115
|
+
f"Failed to download {name} after 8 attempts: {last_err}"
|
|
891
1116
|
)
|
|
892
|
-
progress.advance(dl_task)
|
|
893
1117
|
|
|
894
1118
|
chunk_re = _re.compile(r"^(.+)\.part(\d{4})$")
|
|
895
1119
|
groups: dict = {}
|
|
@@ -898,23 +1122,20 @@ class GitHubStorage:
|
|
|
898
1122
|
if m:
|
|
899
1123
|
groups.setdefault(m.group(1), []).append(f)
|
|
900
1124
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
progress.update(assemble_task, description="[green]Chunks reassembled")
|
|
916
|
-
|
|
917
|
-
progress.update(dl_task, description="[green]Downloaded from GitHub")
|
|
1125
|
+
for original_name, parts in groups.items():
|
|
1126
|
+
parts.sort(key=lambda p: p.name)
|
|
1127
|
+
group_total = sum(p.stat().st_size for p in parts) or 1
|
|
1128
|
+
progress.update(task, completed=0, total=group_total,
|
|
1129
|
+
description=f"[cyan]Joining {escape(original_name)}")
|
|
1130
|
+
out_file = dest / original_name
|
|
1131
|
+
with open(out_file, "wb") as fout:
|
|
1132
|
+
for part in parts:
|
|
1133
|
+
with open(part, "rb") as fin:
|
|
1134
|
+
shutil.copyfileobj(fin, fout, 1 << 20)
|
|
1135
|
+
progress.advance(task, part.stat().st_size)
|
|
1136
|
+
part.unlink()
|
|
1137
|
+
|
|
1138
|
+
progress.update(task, description="[green]Downloaded ✓")
|
|
918
1139
|
|
|
919
1140
|
def delete_old(self, max_keep: int):
|
|
920
1141
|
releases = [
|
|
@@ -940,6 +1161,103 @@ class GitHubStorage:
|
|
|
940
1161
|
raise RuntimeError(f"Failed to delete backup from GitHub: {e}") from e
|
|
941
1162
|
|
|
942
1163
|
|
|
1164
|
+
class StreamAbort(Exception):
|
|
1165
|
+
"""Raised when an upload fails while the archive is being streamed."""
|
|
1166
|
+
def __init__(self, original: Exception):
|
|
1167
|
+
super().__init__(str(original))
|
|
1168
|
+
self.original = original
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
class _PartWriter:
|
|
1172
|
+
"""File-like sink for tarfile. Cuts the stream into CHUNK_SIZE parts and uploads
|
|
1173
|
+
each part as soon as it is full, then deletes it — so the device never needs room
|
|
1174
|
+
for the whole archive. Part names match what `restore` already reassembles."""
|
|
1175
|
+
|
|
1176
|
+
def __init__(self, storage, release_id: int, base_name: str, work_dir: Path, progress: Progress):
|
|
1177
|
+
self.storage, self.release_id, self.base = storage, release_id, base_name
|
|
1178
|
+
self.work_dir, self.progress = work_dir, progress
|
|
1179
|
+
self.limit = storage.CHUNK_SIZE
|
|
1180
|
+
self.idx = 0 # parts uploaded so far
|
|
1181
|
+
self.total = 0 # bytes of the whole archive
|
|
1182
|
+
self.sha = hashlib.sha256() # checksum of the whole archive
|
|
1183
|
+
self._fh = None
|
|
1184
|
+
self._path = None
|
|
1185
|
+
self._size = 0
|
|
1186
|
+
self._task = None
|
|
1187
|
+
self._label = base_name
|
|
1188
|
+
self._next_note = 0
|
|
1189
|
+
|
|
1190
|
+
def attach(self, progress, task, label):
|
|
1191
|
+
self.progress, self._task, self._label = progress, task, label
|
|
1192
|
+
|
|
1193
|
+
def _note(self):
|
|
1194
|
+
if self._task is not None:
|
|
1195
|
+
self.progress.update(
|
|
1196
|
+
self._task,
|
|
1197
|
+
description=f"[cyan]{self._label} [dim]{human_size(self.total)} sent[/dim]",
|
|
1198
|
+
)
|
|
1199
|
+
|
|
1200
|
+
def writable(self):
|
|
1201
|
+
return True
|
|
1202
|
+
|
|
1203
|
+
def flush(self):
|
|
1204
|
+
pass
|
|
1205
|
+
|
|
1206
|
+
def write(self, data) -> int:
|
|
1207
|
+
view, pos, n = memoryview(data), 0, len(data)
|
|
1208
|
+
while pos < n:
|
|
1209
|
+
if self._fh is not None and self._size >= self.limit:
|
|
1210
|
+
self._flush(final=False)
|
|
1211
|
+
if self._fh is None:
|
|
1212
|
+
self._path = self.work_dir / f"{self.base}.part{self.idx:04d}"
|
|
1213
|
+
self._fh, self._size = open(self._path, "wb"), 0
|
|
1214
|
+
piece = view[pos: pos + (self.limit - self._size)]
|
|
1215
|
+
self._fh.write(piece)
|
|
1216
|
+
self._size += len(piece)
|
|
1217
|
+
self.total += len(piece)
|
|
1218
|
+
self.sha.update(piece)
|
|
1219
|
+
pos += len(piece)
|
|
1220
|
+
if self.total >= self._next_note:
|
|
1221
|
+
self._next_note = self.total + (8 << 20)
|
|
1222
|
+
self._note()
|
|
1223
|
+
return n
|
|
1224
|
+
|
|
1225
|
+
def _flush(self, final: bool):
|
|
1226
|
+
self._fh.close()
|
|
1227
|
+
self._fh = None
|
|
1228
|
+
path = self._path
|
|
1229
|
+
if final and self.idx == 0: # small archive: one plain file, no ".part"
|
|
1230
|
+
plain = self.work_dir / self.base
|
|
1231
|
+
path.rename(plain)
|
|
1232
|
+
path = plain
|
|
1233
|
+
task = self.progress.add_task(f"[cyan]{path.name}…", total=max(path.stat().st_size, 1))
|
|
1234
|
+
try:
|
|
1235
|
+
self.storage._upload_one_asset(self.release_id, path, task, self.progress)
|
|
1236
|
+
except Exception as e:
|
|
1237
|
+
raise StreamAbort(e) from e
|
|
1238
|
+
finally:
|
|
1239
|
+
self.progress.remove_task(task)
|
|
1240
|
+
path.unlink(missing_ok=True)
|
|
1241
|
+
self.idx += 1
|
|
1242
|
+
self._note()
|
|
1243
|
+
|
|
1244
|
+
def finish(self):
|
|
1245
|
+
"""Upload the last (possibly partial) part."""
|
|
1246
|
+
if self._fh is not None:
|
|
1247
|
+
self._flush(final=True)
|
|
1248
|
+
|
|
1249
|
+
def abort(self):
|
|
1250
|
+
"""Drop whatever is still on disk."""
|
|
1251
|
+
try:
|
|
1252
|
+
if self._fh is not None:
|
|
1253
|
+
self._fh.close()
|
|
1254
|
+
self._fh = None
|
|
1255
|
+
if self._path is not None:
|
|
1256
|
+
Path(self._path).unlink(missing_ok=True)
|
|
1257
|
+
except Exception:
|
|
1258
|
+
pass
|
|
1259
|
+
|
|
1260
|
+
|
|
943
1261
|
def get_storage(cfg: dict):
|
|
944
1262
|
s = cfg.get("storage", "local")
|
|
945
1263
|
if s == "gdrive":
|
|
@@ -963,6 +1281,11 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
963
1281
|
def _cleanup_tmp():
|
|
964
1282
|
shutil.rmtree(tmp_dir, ignore_errors=True)
|
|
965
1283
|
|
|
1284
|
+
def _abort_backup():
|
|
1285
|
+
if streaming:
|
|
1286
|
+
storage.abort_stream(backup_name)
|
|
1287
|
+
_cleanup_tmp()
|
|
1288
|
+
|
|
966
1289
|
compression = cfg.get("compression", "gz")
|
|
967
1290
|
if compression not in ("gz", "bz2", "xz"):
|
|
968
1291
|
console.print(f" [yellow]⚠ Compression '{compression}' is invalid, falling back to 'gz'.[/yellow]")
|
|
@@ -971,6 +1294,28 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
971
1294
|
excludes = cfg.get("exclude_patterns", [])
|
|
972
1295
|
storage = get_storage(cfg)
|
|
973
1296
|
|
|
1297
|
+
check_storage = getattr(storage, "preflight", None)
|
|
1298
|
+
if check_storage:
|
|
1299
|
+
console.print(" [bold]Check[/bold] Verifying GitHub repository…")
|
|
1300
|
+
try:
|
|
1301
|
+
check_storage()
|
|
1302
|
+
except BaseException:
|
|
1303
|
+
_cleanup_tmp()
|
|
1304
|
+
raise
|
|
1305
|
+
console.print(f" {status_icon(True)} Repository is ready\n")
|
|
1306
|
+
|
|
1307
|
+
streaming = hasattr(storage, "begin_stream")
|
|
1308
|
+
if streaming:
|
|
1309
|
+
try:
|
|
1310
|
+
storage.begin_stream(backup_name, tmp_dir / ".parts")
|
|
1311
|
+
except BaseException:
|
|
1312
|
+
_cleanup_tmp()
|
|
1313
|
+
raise
|
|
1314
|
+
console.print(
|
|
1315
|
+
f" {status_icon(True)} Streaming upload: the archive is sent in parts, "
|
|
1316
|
+
"so your device never holds a full copy\n"
|
|
1317
|
+
)
|
|
1318
|
+
|
|
974
1319
|
meta = {
|
|
975
1320
|
"name": backup_name,
|
|
976
1321
|
"date": datetime.datetime.now().isoformat(),
|
|
@@ -993,18 +1338,11 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
993
1338
|
log("INFO", f"Collected {len(pkgs)} packages")
|
|
994
1339
|
|
|
995
1340
|
console.print()
|
|
996
|
-
console.print(" [bold]Step 2/4[/bold]
|
|
1341
|
+
console.print(" [bold]Step 2/4[/bold] " +
|
|
1342
|
+
("Archiving & uploading directories…" if streaming else "Archiving directories…"))
|
|
997
1343
|
console.print()
|
|
998
1344
|
|
|
999
|
-
with
|
|
1000
|
-
SpinnerColumn(),
|
|
1001
|
-
TextColumn(" {task.description}"),
|
|
1002
|
-
BarColumn(bar_width=30),
|
|
1003
|
-
TextColumn("[dim]{task.percentage:>3.0f}%"),
|
|
1004
|
-
TimeElapsedColumn(),
|
|
1005
|
-
console=console,
|
|
1006
|
-
expand=False,
|
|
1007
|
-
) as progress:
|
|
1345
|
+
with make_progress() as progress:
|
|
1008
1346
|
archive_items = [
|
|
1009
1347
|
("home", "Home directory (~)", TERMUX_FILES),
|
|
1010
1348
|
("usr_etc", "Termux config (/usr/etc)", TERMUX_HOME / "etc"),
|
|
@@ -1014,17 +1352,43 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
1014
1352
|
console.print(f" [yellow]⚠ Skipping {src} (not found)[/yellow]")
|
|
1015
1353
|
continue
|
|
1016
1354
|
out_path = tmp_dir / f"{key}.tar.{compression}"
|
|
1355
|
+
sink = storage.stream_sink(out_path.name, progress) if streaming else None
|
|
1017
1356
|
try:
|
|
1018
|
-
actual_out = create_archive(src, out_path, compression, excludes, label_text,
|
|
1019
|
-
|
|
1357
|
+
actual_out = create_archive(src, out_path, compression, excludes, label_text,
|
|
1358
|
+
progress, sink=sink)
|
|
1359
|
+
if sink is not None:
|
|
1360
|
+
sink.finish()
|
|
1361
|
+
archive_size, checksum = sink.total, sink.sha.hexdigest()
|
|
1362
|
+
else:
|
|
1363
|
+
checksum = sha256(actual_out)
|
|
1364
|
+
archive_size = actual_out.stat().st_size
|
|
1020
1365
|
meta["files"][key] = {
|
|
1021
1366
|
"archive": actual_out.name,
|
|
1022
|
-
"size":
|
|
1367
|
+
"size": archive_size,
|
|
1023
1368
|
"checksum": checksum,
|
|
1024
1369
|
"source": str(src),
|
|
1025
1370
|
}
|
|
1026
|
-
log("INFO", f"Archived {src} → {actual_out.name} ({human_size(
|
|
1371
|
+
log("INFO", f"Archived {src} → {actual_out.name} ({human_size(archive_size)})")
|
|
1372
|
+
except (StreamAbort, KeyboardInterrupt):
|
|
1373
|
+
if sink is not None:
|
|
1374
|
+
sink.abort()
|
|
1375
|
+
for t in list(progress.tasks):
|
|
1376
|
+
progress.remove_task(t.id)
|
|
1377
|
+
_abort_backup()
|
|
1378
|
+
raise
|
|
1379
|
+
except OSError as e:
|
|
1380
|
+
if sink is not None:
|
|
1381
|
+
sink.abort()
|
|
1382
|
+
if e.errno == errno.ENOSPC: # out of space: stop, don't continue silently
|
|
1383
|
+
for t in list(progress.tasks):
|
|
1384
|
+
progress.remove_task(t.id)
|
|
1385
|
+
_abort_backup()
|
|
1386
|
+
raise
|
|
1387
|
+
console.print(f" [red]✗ Failed to archive {src}: {escape(str(e))}[/red]")
|
|
1388
|
+
log("ERROR", f"Archive failed for {src}: {e}")
|
|
1027
1389
|
except Exception as e:
|
|
1390
|
+
if sink is not None:
|
|
1391
|
+
sink.abort()
|
|
1028
1392
|
console.print(f" [red]✗ Failed to archive {src}: {escape(str(e))}[/red]")
|
|
1029
1393
|
log("ERROR", f"Archive failed for {src}: {e}")
|
|
1030
1394
|
|
|
@@ -1038,24 +1402,32 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
1038
1402
|
console.print()
|
|
1039
1403
|
|
|
1040
1404
|
location = ""
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
TextColumn(" {task.description}"),
|
|
1044
|
-
BarColumn(bar_width=30),
|
|
1045
|
-
TimeElapsedColumn(),
|
|
1046
|
-
console=console,
|
|
1047
|
-
) as progress:
|
|
1405
|
+
upload_error = None
|
|
1406
|
+
with make_progress() as progress:
|
|
1048
1407
|
try:
|
|
1049
1408
|
location = storage.upload(tmp_dir, backup_name, progress)
|
|
1050
1409
|
storage.delete_old(cfg.get("max_backups", 5))
|
|
1051
1410
|
except KeyboardInterrupt:
|
|
1052
|
-
|
|
1411
|
+
_abort_backup()
|
|
1053
1412
|
raise
|
|
1054
1413
|
except Exception as e:
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1414
|
+
upload_error = e
|
|
1415
|
+
for t in list(progress.tasks): # drop the half-finished spinner line
|
|
1416
|
+
progress.remove_task(t.id)
|
|
1417
|
+
|
|
1418
|
+
if upload_error is not None:
|
|
1419
|
+
log("ERROR", f"Upload failed: {upload_error}")
|
|
1420
|
+
title, message, hint = _explain(upload_error)
|
|
1421
|
+
print_error(f"Upload failed — {title}", message, hint)
|
|
1422
|
+
if streaming:
|
|
1423
|
+
_abort_backup() # remove the incomplete release so it never counts as a backup
|
|
1424
|
+
console.print(" [dim]The incomplete backup was removed from GitHub.[/dim]\n")
|
|
1425
|
+
else:
|
|
1426
|
+
console.print(" [bold]Your backup files were kept[/bold] so the work is not lost:")
|
|
1427
|
+
console.print(f" [white]{escape(str(tmp_dir))}[/white]", soft_wrap=True)
|
|
1428
|
+
console.print(" [dim]Delete them when you no longer need them:[/dim]")
|
|
1429
|
+
console.print(f" rm -rf {escape(str(tmp_dir))}\n", soft_wrap=True)
|
|
1430
|
+
return
|
|
1059
1431
|
|
|
1060
1432
|
shutil.rmtree(tmp_dir, ignore_errors=True)
|
|
1061
1433
|
|
|
@@ -1064,15 +1436,15 @@ def cmd_backup(cfg: dict, label: str = ""):
|
|
|
1064
1436
|
console.print()
|
|
1065
1437
|
console.print(Panel(
|
|
1066
1438
|
f"[bold green]✓ Backup completed successfully![/bold green]\n\n"
|
|
1067
|
-
f"
|
|
1068
|
-
f"
|
|
1069
|
-
f"
|
|
1070
|
-
f"
|
|
1071
|
-
f"
|
|
1072
|
-
f"
|
|
1073
|
-
title="[bold yellow]
|
|
1439
|
+
f"[dim]Name [/dim] [white]{escape(backup_name)}[/white]\n"
|
|
1440
|
+
f"[dim]Date [/dim] [white]{meta['date'][:19].replace('T', ' ')}[/white]\n"
|
|
1441
|
+
f"[dim]Packages[/dim] [white]{len(pkgs)}[/white]\n"
|
|
1442
|
+
f"[dim]Size [/dim] [white]{human_size(total_size)}[/white]\n"
|
|
1443
|
+
f"[dim]Storage [/dim] [white]{cfg['storage'].upper()}[/white]\n"
|
|
1444
|
+
f"[dim]Location[/dim] [white]{escape(short_path(location))}[/white]",
|
|
1445
|
+
title="[bold yellow]Backup Summary[/bold yellow]",
|
|
1074
1446
|
border_style="green",
|
|
1075
|
-
padding=(
|
|
1447
|
+
padding=(0, 2),
|
|
1076
1448
|
))
|
|
1077
1449
|
log("INFO", f"Backup completed: {backup_name} ({human_size(total_size)})")
|
|
1078
1450
|
|
|
@@ -1090,32 +1462,7 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1090
1462
|
return
|
|
1091
1463
|
|
|
1092
1464
|
if not backup_name:
|
|
1093
|
-
|
|
1094
|
-
box=box.ROUNDED,
|
|
1095
|
-
title="[bold yellow]Available Backups[/bold yellow]",
|
|
1096
|
-
show_header=True,
|
|
1097
|
-
header_style="bold cyan",
|
|
1098
|
-
padding=(0, 1),
|
|
1099
|
-
)
|
|
1100
|
-
table.add_column("#", style="dim", width=4)
|
|
1101
|
-
table.add_column("Name", style="bold white", min_width=30)
|
|
1102
|
-
table.add_column("Date", style="green")
|
|
1103
|
-
table.add_column("Label", style="yellow")
|
|
1104
|
-
table.add_column("Packages", style="cyan", justify="right")
|
|
1105
|
-
table.add_column("Storage", style="blue")
|
|
1106
|
-
|
|
1107
|
-
for i, b in enumerate(backups, 1):
|
|
1108
|
-
table.add_row(
|
|
1109
|
-
str(i),
|
|
1110
|
-
b.get("name", "—"),
|
|
1111
|
-
b.get("date", "—")[:19].replace("T", " "),
|
|
1112
|
-
b.get("label", "") or "—",
|
|
1113
|
-
str(len(b.get("packages", []))),
|
|
1114
|
-
b.get("storage", cfg["storage"]).upper(),
|
|
1115
|
-
)
|
|
1116
|
-
|
|
1117
|
-
console.print(table)
|
|
1118
|
-
console.print()
|
|
1465
|
+
print_backup_list(backups)
|
|
1119
1466
|
|
|
1120
1467
|
choice = Prompt.ask(" [bold]Enter backup number or name[/bold]", default="1")
|
|
1121
1468
|
try:
|
|
@@ -1138,20 +1485,22 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1138
1485
|
|
|
1139
1486
|
console.print()
|
|
1140
1487
|
console.print(" [bold]Step 1/4[/bold] Downloading backup…")
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
TextColumn(" {task.description}"),
|
|
1144
|
-
BarColumn(bar_width=30),
|
|
1145
|
-
TimeElapsedColumn(),
|
|
1146
|
-
console=console,
|
|
1147
|
-
) as progress:
|
|
1488
|
+
t0 = time.monotonic()
|
|
1489
|
+
with make_progress(transient=True, percent=True) as progress:
|
|
1148
1490
|
try:
|
|
1149
1491
|
storage.download(backup_name, tmp_dir, progress)
|
|
1150
1492
|
except Exception as e:
|
|
1493
|
+
progress.stop()
|
|
1151
1494
|
console.print(f" [red]✗ Download failed: {escape(str(e))}[/red]")
|
|
1152
1495
|
log("ERROR", f"Download failed: {e}")
|
|
1153
1496
|
shutil.rmtree(tmp_dir, ignore_errors=True)
|
|
1154
1497
|
return
|
|
1498
|
+
dl_files = [f for f in tmp_dir.iterdir() if f.is_file()]
|
|
1499
|
+
console.print(
|
|
1500
|
+
f" {status_icon(True)} Downloaded {len(dl_files)} files "
|
|
1501
|
+
f"[dim]({human_size(sum(f.stat().st_size for f in dl_files))}, "
|
|
1502
|
+
f"{fmt_elapsed(time.monotonic() - t0)})[/dim]"
|
|
1503
|
+
)
|
|
1155
1504
|
|
|
1156
1505
|
manifest = read_manifest(tmp_dir)
|
|
1157
1506
|
if not manifest:
|
|
@@ -1171,7 +1520,7 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1171
1520
|
cs = sha256(archive)
|
|
1172
1521
|
ok = cs == info.get("checksum", cs)
|
|
1173
1522
|
icon = status_icon(ok)
|
|
1174
|
-
console.print(f" {icon} {info['archive']} [dim]{cs[:
|
|
1523
|
+
console.print(f" {icon} {info['archive']} [dim]{cs[:12]}…[/dim]")
|
|
1175
1524
|
if not ok:
|
|
1176
1525
|
all_ok = False
|
|
1177
1526
|
|
|
@@ -1182,30 +1531,25 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1182
1531
|
|
|
1183
1532
|
console.print()
|
|
1184
1533
|
console.print(Panel(
|
|
1185
|
-
f" [
|
|
1186
|
-
f"
|
|
1187
|
-
f"
|
|
1188
|
-
f"
|
|
1189
|
-
f"
|
|
1190
|
-
title="[bold yellow]
|
|
1534
|
+
f"[dim]Backup [/dim] [white]{escape(backup_name)}[/white]\n"
|
|
1535
|
+
f"[dim]Date [/dim] [white]{manifest.get('date', '—')[:19].replace('T', ' ')}[/white]\n"
|
|
1536
|
+
f"[dim]Packages[/dim] [white]{len(manifest.get('packages', []))}[/white]\n"
|
|
1537
|
+
f"[dim]Archives[/dim] [white]{len(manifest.get('files', {}))}[/white] "
|
|
1538
|
+
f"[dim]({human_size(_backup_size(manifest))})[/dim]",
|
|
1539
|
+
title="[bold yellow]Restore Preview[/bold yellow]",
|
|
1191
1540
|
border_style="yellow",
|
|
1192
|
-
padding=(
|
|
1541
|
+
padding=(0, 2),
|
|
1193
1542
|
))
|
|
1543
|
+
console.print(" [yellow]⚠ This will overwrite existing files.[/yellow]")
|
|
1194
1544
|
|
|
1195
|
-
if not Confirm.ask("
|
|
1545
|
+
if not Confirm.ask(" [bold yellow]Proceed with restore?[/bold yellow]"):
|
|
1196
1546
|
console.print(" [dim]Restore cancelled.[/dim]")
|
|
1197
1547
|
shutil.rmtree(tmp_dir, ignore_errors=True)
|
|
1198
1548
|
return
|
|
1199
1549
|
|
|
1200
1550
|
console.print()
|
|
1201
1551
|
console.print(" [bold]Step 3/4[/bold] Extracting archives…")
|
|
1202
|
-
with
|
|
1203
|
-
SpinnerColumn(),
|
|
1204
|
-
TextColumn(" {task.description}"),
|
|
1205
|
-
BarColumn(bar_width=30),
|
|
1206
|
-
TimeElapsedColumn(),
|
|
1207
|
-
console=console,
|
|
1208
|
-
) as progress:
|
|
1552
|
+
with make_progress() as progress:
|
|
1209
1553
|
# Build the set of destinations this app is actually willing to restore into.
|
|
1210
1554
|
# Manifest-supplied "source" values are attacker-controlled backup content
|
|
1211
1555
|
# and must never be trusted as an extraction root — only used to double
|
|
@@ -1244,11 +1588,11 @@ def cmd_restore(cfg: dict, backup_name: str = ""):
|
|
|
1244
1588
|
|
|
1245
1589
|
console.print()
|
|
1246
1590
|
console.print(Panel(
|
|
1247
|
-
"[bold green]✓ Restore completed successfully![/bold green]\n
|
|
1248
|
-
"
|
|
1249
|
-
title="[bold yellow]
|
|
1591
|
+
"[bold green]✓ Restore completed successfully![/bold green]\n"
|
|
1592
|
+
"Please restart Termux for all changes to take effect.",
|
|
1593
|
+
title="[bold yellow]Restore Summary[/bold yellow]",
|
|
1250
1594
|
border_style="green",
|
|
1251
|
-
padding=(
|
|
1595
|
+
padding=(0, 2),
|
|
1252
1596
|
))
|
|
1253
1597
|
log("INFO", f"Restore completed from: {backup_name}")
|
|
1254
1598
|
|
|
@@ -1267,17 +1611,17 @@ def cmd_list(cfg: dict):
|
|
|
1267
1611
|
|
|
1268
1612
|
for i, b in enumerate(backups, 1):
|
|
1269
1613
|
tbl = Table(
|
|
1270
|
-
box=box.ROUNDED,
|
|
1614
|
+
box=None if is_narrow() else box.ROUNDED,
|
|
1271
1615
|
show_header=False,
|
|
1272
|
-
padding=(0,
|
|
1616
|
+
padding=(0, 1),
|
|
1273
1617
|
title=f"[bold white]Backup #{i}[/bold white]",
|
|
1274
1618
|
)
|
|
1275
|
-
tbl.add_column("Key", style="dim cyan", min_width=
|
|
1619
|
+
tbl.add_column("Key", style="dim cyan", min_width=12)
|
|
1276
1620
|
tbl.add_column("Value", style="bold white")
|
|
1277
1621
|
|
|
1278
|
-
tbl.add_row("Name", b.get("name", "—"))
|
|
1622
|
+
tbl.add_row("Name", escape(str(b.get("name", "—"))))
|
|
1279
1623
|
tbl.add_row("Date", b.get("date", "—")[:19].replace("T", " "))
|
|
1280
|
-
tbl.add_row("Label", b
|
|
1624
|
+
tbl.add_row("Label", escape(_backup_label(b)) or "—")
|
|
1281
1625
|
tbl.add_row("Packages", str(len(b.get("packages", []))))
|
|
1282
1626
|
tbl.add_row("Files", str(len(b.get("files", {}))))
|
|
1283
1627
|
tbl.add_row("Version", b.get("version", "—"))
|
|
@@ -1302,28 +1646,7 @@ def cmd_delete(cfg: dict, backup_name: str = ""):
|
|
|
1302
1646
|
console.print(" [yellow]No backups found.[/yellow]")
|
|
1303
1647
|
return
|
|
1304
1648
|
|
|
1305
|
-
|
|
1306
|
-
box=box.ROUNDED,
|
|
1307
|
-
title="[bold yellow]Available Backups[/bold yellow]",
|
|
1308
|
-
show_header=True,
|
|
1309
|
-
header_style="bold cyan",
|
|
1310
|
-
padding=(0, 1),
|
|
1311
|
-
)
|
|
1312
|
-
table.add_column("#", style="dim", width=4)
|
|
1313
|
-
table.add_column("Name", style="bold white", min_width=30)
|
|
1314
|
-
table.add_column("Date", style="green")
|
|
1315
|
-
table.add_column("Label", style="yellow")
|
|
1316
|
-
|
|
1317
|
-
for i, b in enumerate(backups, 1):
|
|
1318
|
-
table.add_row(
|
|
1319
|
-
str(i),
|
|
1320
|
-
b.get("name", "—"),
|
|
1321
|
-
b.get("date", "—")[:19].replace("T", " "),
|
|
1322
|
-
b.get("label", "") or "—",
|
|
1323
|
-
)
|
|
1324
|
-
|
|
1325
|
-
console.print(table)
|
|
1326
|
-
console.print()
|
|
1649
|
+
print_backup_list(backups)
|
|
1327
1650
|
|
|
1328
1651
|
if not backup_name:
|
|
1329
1652
|
choice = Prompt.ask(" [bold]Enter backup number or name to delete[/bold]")
|
|
@@ -1357,9 +1680,9 @@ def cmd_setup():
|
|
|
1357
1680
|
cfg = load_config()
|
|
1358
1681
|
|
|
1359
1682
|
console.print(" Choose your [bold]storage backend[/bold]:\n")
|
|
1360
|
-
console.print(" [bold cyan][1][/bold cyan] Local storage
|
|
1361
|
-
console.print(" [bold cyan][2][/bold cyan] Google Drive
|
|
1362
|
-
console.print(" [bold cyan][3][/bold cyan] GitHub
|
|
1683
|
+
console.print(" [bold cyan][1][/bold cyan] Local storage [dim]on device[/dim]")
|
|
1684
|
+
console.print(" [bold cyan][2][/bold cyan] Google Drive [dim]via rclone[/dim]")
|
|
1685
|
+
console.print(" [bold cyan][3][/bold cyan] GitHub [dim]private repo[/dim] [bold yellow]★ Recommended[/bold yellow]")
|
|
1363
1686
|
console.print()
|
|
1364
1687
|
|
|
1365
1688
|
choice = Prompt.ask(" Storage", choices=["1", "2", "3"], default="3")
|
|
@@ -1387,21 +1710,23 @@ def cmd_setup():
|
|
|
1387
1710
|
|
|
1388
1711
|
elif cfg["storage"] == "github":
|
|
1389
1712
|
console.print()
|
|
1390
|
-
|
|
1391
|
-
"
|
|
1713
|
+
note(
|
|
1714
|
+
"[dim]Create a [bold]private repository[/bold] on GitHub and generate a"
|
|
1392
1715
|
" Personal Access Token with [white]repo[/white] scope.[/dim]"
|
|
1393
1716
|
)
|
|
1394
|
-
console.print(" [dim]Token
|
|
1717
|
+
console.print(" [dim]Token page:[/dim]")
|
|
1718
|
+
console.print(" [white]https://github.com/settings/tokens[/white]", soft_wrap=True)
|
|
1395
1719
|
console.print()
|
|
1396
1720
|
|
|
1397
1721
|
existing_token = cfg.get("github_token", "")
|
|
1398
1722
|
if existing_token:
|
|
1399
|
-
|
|
1723
|
+
note("[dim]A token is already saved. Press Enter to keep it, or paste a new one.[/dim]")
|
|
1400
1724
|
while True:
|
|
1401
1725
|
val = Prompt.ask(
|
|
1402
|
-
" GitHub
|
|
1726
|
+
" GitHub token",
|
|
1403
1727
|
default=existing_token,
|
|
1404
1728
|
password=True,
|
|
1729
|
+
show_default=False, # never print a saved token back to the screen
|
|
1405
1730
|
).strip()
|
|
1406
1731
|
if val:
|
|
1407
1732
|
cfg["github_token"] = val
|
|
@@ -1410,7 +1735,9 @@ def cmd_setup():
|
|
|
1410
1735
|
|
|
1411
1736
|
while True:
|
|
1412
1737
|
val = Prompt.ask(
|
|
1413
|
-
" GitHub repo (owner/repo)",
|
|
1738
|
+
" GitHub repo [dim](owner/repo)[/dim]",
|
|
1739
|
+
default=cfg.get("github_repo", ""),
|
|
1740
|
+
show_default=bool(cfg.get("github_repo", "")),
|
|
1414
1741
|
).strip()
|
|
1415
1742
|
if not val:
|
|
1416
1743
|
console.print(" [red]✗ Repo cannot be empty. Enter in format: username/repo-name[/red]")
|
|
@@ -1426,8 +1753,9 @@ def cmd_setup():
|
|
|
1426
1753
|
)
|
|
1427
1754
|
|
|
1428
1755
|
console.print()
|
|
1756
|
+
console.print(" [dim]Compression: gz = fast · bz2 = balanced · xz = best[/dim]")
|
|
1429
1757
|
cfg["compression"] = Prompt.ask(
|
|
1430
|
-
" Compression
|
|
1758
|
+
" Compression",
|
|
1431
1759
|
choices=["gz", "bz2", "xz"], default=cfg.get("compression", "gz")
|
|
1432
1760
|
)
|
|
1433
1761
|
while True:
|
|
@@ -1439,11 +1767,16 @@ def cmd_setup():
|
|
|
1439
1767
|
|
|
1440
1768
|
console.print()
|
|
1441
1769
|
current_patterns = cfg.get("exclude_patterns", [])
|
|
1442
|
-
preview = ", ".join(current_patterns[:
|
|
1443
|
-
|
|
1770
|
+
preview = ", ".join(current_patterns[:4])
|
|
1771
|
+
if len(current_patterns) > 4:
|
|
1772
|
+
preview += f" … +{len(current_patterns) - 4} more"
|
|
1773
|
+
note(f"[dim]Exclude patterns ({len(current_patterns)}): {escape(preview)}[/dim]")
|
|
1444
1774
|
if Confirm.ask(" Customise exclude patterns?", default=False):
|
|
1445
|
-
console.print(
|
|
1446
|
-
|
|
1775
|
+
console.print()
|
|
1776
|
+
console.print(Padding(escape(", ".join(current_patterns)), (0, 0, 0, 4)), style="dim")
|
|
1777
|
+
console.print()
|
|
1778
|
+
note("[dim]Type the new list separated by commas. Press Enter to keep the list above.[/dim]")
|
|
1779
|
+
raw = Prompt.ask(" Patterns", default="", show_default=False)
|
|
1447
1780
|
if raw.strip():
|
|
1448
1781
|
cfg["exclude_patterns"] = [p.strip() for p in raw.split(",") if p.strip()]
|
|
1449
1782
|
|
|
@@ -1451,9 +1784,10 @@ def cmd_setup():
|
|
|
1451
1784
|
console.print()
|
|
1452
1785
|
console.print(Panel(
|
|
1453
1786
|
f"[bold green]✓ Configuration saved![/bold green]\n\n"
|
|
1454
|
-
f"
|
|
1455
|
-
f"
|
|
1456
|
-
|
|
1787
|
+
f"[dim]Storage[/dim] [white]{cfg['storage'].upper()}[/white]\n"
|
|
1788
|
+
f"[dim]Config [/dim] [white]{escape(short_path(CONFIG_FILE))}[/white]",
|
|
1789
|
+
title="[bold yellow]Setup Summary[/bold yellow]",
|
|
1790
|
+
border_style="green", padding=(0, 2)
|
|
1457
1791
|
))
|
|
1458
1792
|
log("INFO", f"Setup complete. Storage: {cfg['storage']}")
|
|
1459
1793
|
|
|
@@ -1563,18 +1897,30 @@ def cmd_daemon(cfg: dict):
|
|
|
1563
1897
|
log("ERROR", f"Daemon backup failed: {e}")
|
|
1564
1898
|
|
|
1565
1899
|
|
|
1900
|
+
def short_path(p) -> str:
|
|
1901
|
+
"""Shorten long Termux paths for narrow screens: $PREFIX/bin/tar, ~/.config/..."""
|
|
1902
|
+
text = str(p)
|
|
1903
|
+
prefix = os.environ.get("PREFIX", "/data/data/com.termux/files/usr")
|
|
1904
|
+
home = str(Path.home())
|
|
1905
|
+
if text == prefix or text.startswith(prefix + "/"):
|
|
1906
|
+
return "$PREFIX" + text[len(prefix):]
|
|
1907
|
+
if text == home or text.startswith(home + "/"):
|
|
1908
|
+
return "~" + text[len(home):]
|
|
1909
|
+
return text
|
|
1910
|
+
|
|
1911
|
+
|
|
1566
1912
|
def cmd_status(cfg: dict):
|
|
1567
1913
|
print_section("STATUS", "Current configuration and environment")
|
|
1568
1914
|
|
|
1569
1915
|
sched = load_schedule()
|
|
1570
1916
|
|
|
1571
|
-
cfg_table = Table(box=box.ROUNDED, show_header=False, padding=(0,
|
|
1572
|
-
cfg_table.add_column("Key", style="dim cyan",
|
|
1573
|
-
cfg_table.add_column("Value", style="bold white")
|
|
1917
|
+
cfg_table = Table(box=box.ROUNDED, show_header=False, padding=(0, 1))
|
|
1918
|
+
cfg_table.add_column("Key", style="dim cyan", no_wrap=True)
|
|
1919
|
+
cfg_table.add_column("Value", style="bold white", overflow="fold")
|
|
1574
1920
|
|
|
1575
1921
|
cfg_table.add_row("Storage backend", cfg.get("storage", "local").upper())
|
|
1576
1922
|
if cfg["storage"] == "local":
|
|
1577
|
-
cfg_table.add_row("Local path", cfg.get("local_path", "—"))
|
|
1923
|
+
cfg_table.add_row("Local path", short_path(cfg.get("local_path", "—")))
|
|
1578
1924
|
elif cfg["storage"] == "gdrive":
|
|
1579
1925
|
cfg_table.add_row("Drive folder", cfg.get("gdrive_folder_id", "(root)") or "(root)")
|
|
1580
1926
|
elif cfg["storage"] == "github":
|
|
@@ -1586,30 +1932,35 @@ def cmd_status(cfg: dict):
|
|
|
1586
1932
|
if sched.get("enabled"):
|
|
1587
1933
|
cfg_table.add_row("Schedule", f"Daily at {sched['hour']:02d}:{sched['minute']:02d}")
|
|
1588
1934
|
cfg_table.add_row("App version", f"v{VERSION}")
|
|
1589
|
-
|
|
1590
|
-
|
|
1935
|
+
for key, path in (("Config file", CONFIG_FILE), ("Log file", LOG_FILE)):
|
|
1936
|
+
folder, _, fname = short_path(path).rpartition("/")
|
|
1937
|
+
cfg_table.add_row(key, f"{escape(folder)}/\n{escape(fname)}")
|
|
1591
1938
|
|
|
1592
1939
|
console.print(cfg_table)
|
|
1593
1940
|
console.print()
|
|
1594
1941
|
|
|
1595
|
-
env_table = Table(box=box.ROUNDED, show_header=False, padding=(0,
|
|
1942
|
+
env_table = Table(box=box.ROUNDED, show_header=False, padding=(0, 1),
|
|
1596
1943
|
title="[bold yellow]Environment[/bold yellow]")
|
|
1597
|
-
env_table.add_column("Tool", style="dim cyan",
|
|
1598
|
-
env_table.add_column("
|
|
1944
|
+
env_table.add_column("Tool", style="dim cyan", no_wrap=True)
|
|
1945
|
+
env_table.add_column("", no_wrap=True, width=1)
|
|
1946
|
+
env_table.add_column("Path", overflow="fold")
|
|
1599
1947
|
|
|
1948
|
+
storage = cfg.get("storage", "local")
|
|
1600
1949
|
checks = [
|
|
1601
|
-
("python3", shutil.which("python3")),
|
|
1602
|
-
("dpkg", shutil.which("dpkg")),
|
|
1603
|
-
("tar", shutil.which("tar")),
|
|
1604
|
-
("rclone", shutil.which("rclone")),
|
|
1605
|
-
("git", shutil.which("git")),
|
|
1606
|
-
("curl", shutil.which("curl")),
|
|
1950
|
+
("python3", shutil.which("python3"), True),
|
|
1951
|
+
("dpkg", shutil.which("dpkg"), True),
|
|
1952
|
+
("tar", shutil.which("tar"), True),
|
|
1953
|
+
("rclone", shutil.which("rclone"), storage == "gdrive"), # only needed for Google Drive
|
|
1954
|
+
("git", shutil.which("git"), True),
|
|
1955
|
+
("curl", shutil.which("curl"), True),
|
|
1607
1956
|
]
|
|
1608
|
-
for name, path in checks:
|
|
1957
|
+
for name, path, needed in checks:
|
|
1609
1958
|
if path:
|
|
1610
|
-
env_table.add_row(name,
|
|
1959
|
+
env_table.add_row(name, "[green]✓[/green]", f"[green]{escape(short_path(path))}[/green]")
|
|
1960
|
+
elif needed:
|
|
1961
|
+
env_table.add_row(name, "[red]✗[/red]", f"[red]missing[/red] [dim]— pkg install {name}[/dim]")
|
|
1611
1962
|
else:
|
|
1612
|
-
env_table.add_row(name, "[
|
|
1963
|
+
env_table.add_row(name, "[dim]–[/dim]", f"[dim]not needed for {storage.upper()}[/dim]")
|
|
1613
1964
|
|
|
1614
1965
|
console.print(env_table)
|
|
1615
1966
|
|
|
File without changes
|
|
File without changes
|