docs(plans): incorporate shell tab completion specifications into linux-backuper

This commit is contained in:
soda64 committed 2026-10-03 06:37:57 +02:00
1 parent baa8e7bb92
commit 1c4ce51ae6
4 files changed
+34 -5

No files matched your search

+5 -1
View File
@@ -13,7 +13,7 @@
- [ ] Slice 5 — retention policy & pruning engine (`--keep-last`, `--keep-daily`, automated cleanup) - [ ] Slice 5 — retention policy & pruning engine (`--keep-last`, `--keep-daily`, automated cleanup)
- [ ] Slice 6 — remote destination engine (SFTP / SCP / rsync / NFS export sync) - [ ] Slice 6 — remote destination engine (SFTP / SCP / rsync / NFS export sync)
- [ ] Slice 7 — packaging & distribution (.deb, .rpm, .tar.gz standalone) - [ ] Slice 7 — packaging & distribution (.deb, .rpm, .tar.gz standalone)
- [ ] Slice 8 — full documentation (user, admin & developer guides), man page (Section 8), CLI -h/--help & Gitea Actions CI/CD release workflow - [ ] Slice 8 — full documentation (user, admin & developer guides), man page (Section 8), CLI -h/--help, shell tab completion (Bash/Zsh) & Gitea Actions CI/CD release workflow
## Notes for a fresh session ## Notes for a fresh session
- Project: Enterprise-grade Linux system snapshot and configuration backup utility. - Project: Enterprise-grade Linux system snapshot and configuration backup utility.
@@ -22,6 +22,10 @@
- Platforms: Debian 11/12, Ubuntu 20.04/22.04/24.04, RHEL 8/9, AlmaLinux 8/9, Rocky Linux 8/9, Fedora 39/40/41, Arch Linux. - Platforms: Debian 11/12, Ubuntu 20.04/22.04/24.04, RHEL 8/9, AlmaLinux 8/9, Rocky Linux 8/9, Fedora 39/40/41, Arch Linux.
- Target Python runtime: Python >= 3.6 (RHEL 8 compatibility). - Target Python runtime: Python >= 3.6 (RHEL 8 compatibility).
- Dependencies: Zero mandatory external dependencies (pure Python standard library). Optional `cryptography` for encrypted snapshots. - Dependencies: Zero mandatory external dependencies (pure Python standard library). Optional `cryptography` for encrypted snapshots.
- Shell Tab Completion Standard (Bash & Zsh):
- Subcommands and flags auto-completion (`snapshot`, `list`, `show`, `diff`, `verify`, `extract`, `prune`).
- Dynamic completion: `show`, `diff`, `verify`, `extract` auto-complete snapshot IDs from `/var/backups/linux-backuper/`.
- Built-in `linux-backuper completion [bash|zsh]` generator + system-wide package deployment (`/usr/share/bash-completion/completions/` and `/usr/share/zsh/site-functions/`).
- Documentation Standard (Mandatory parity with linux-updater): - Documentation Standard (Mandatory parity with linux-updater):
- User Guide: `docs/user-guide.md` (comprehensive operator workflow and snapshot recovery). - User Guide: `docs/user-guide.md` (comprehensive operator workflow and snapshot recovery).
- Administrator Guide: `docs/admin-guide.md` (automation, systemd timer/cron setup, logrotate, monitoring, JSON parsing). - Administrator Guide: `docs/admin-guide.md` (automation, systemd timer/cron setup, logrotate, monitoring, JSON parsing).
+16
View File
@@ -106,3 +106,19 @@ To guarantee consistency across the homelab tooling ecosystem, `linux-backuper`
- Root `linux-backuper -h` outputs an intuitive summary of all sub-commands with usage hints. - Root `linux-backuper -h` outputs an intuitive summary of all sub-commands with usage hints.
- Each sub-command (`snapshot -h`, `list -h`, `show -h`, `diff -h`, `verify -h`, `extract -h`, `prune -h`) provides full argument descriptions, default values, and concrete examples. - Each sub-command (`snapshot -h`, `list -h`, `show -h`, `diff -h`, `verify -h`, `extract -h`, `prune -h`) provides full argument descriptions, default values, and concrete examples.
---
## 7. Shell Tab Completion (Bash & Zsh)
To provide a smooth, fast terminal experience in everyday administration, `linux-backuper` includes first-class shell completion:
1. **Command & Option Completion:**
- Hitting `Tab` after `linux-backuper ` suggests all sub-commands (`snapshot`, `list`, `show`, `diff`, `verify`, `extract`, `prune`, `completion`).
- Hitting `Tab` after flags suggests options (`--keep-last`, `--keep-daily`, `--paths`, `--json`, `--verbose`).
2. **Dynamic Context-Aware Completion:**
- `linux-backuper show <Tab>` $\rightarrow$ automatically inspects `/var/backups/linux-backuper/` and suggests available `snapshot_id` names.
- `linux-backuper diff <Tab>` $\rightarrow$ suggests available snapshot IDs for comparison.
- `linux-backuper extract <Tab>` $\rightarrow$ suggests snapshot IDs, and after `--file <Tab>` suggests archived files.
3. **On-Demand Script Generation & System Packaging:**
- Dedicated generator command: `linux-backuper completion [bash|zsh]` outputs ready-to-source completion scripts.
- System packages (`.deb` and `.rpm`) automatically install completions to `/usr/share/bash-completion/completions/linux-backuper` and `/usr/share/zsh/site-functions/_linux-backuper`.
@@ -21,13 +21,19 @@ linux-backuper/
│ │ ├── archiver.py # Tar/gzip/zstd packaging & atomic write │ │ ├── archiver.py # Tar/gzip/zstd packaging & atomic write
│ │ ├── manifest.py # Manifest generator, reader & validator │ │ ├── manifest.py # Manifest generator, reader & validator
│ │ ├── retention.py # Pruning calculation engine │ │ ├── retention.py # Pruning calculation engine
│ │ └── diff.py # Snapshot comparison engine │ │ ├── diff.py # Snapshot comparison engine
│ │ └── completion.py # Shell completion generator & dynamic snapshot resolver
│ └── managers/ │ └── managers/
│ ├── __init__.py │ ├── __init__.py
│ ├── base.py # BasePackageManager class │ ├── base.py # BasePackageManager class
│ ├── rpm.py # RPM/DNF/YUM inspector │ ├── rpm.py # RPM/DNF/YUM inspector
│ ├── dpkg.py # DPKG/APT inspector │ ├── dpkg.py # DPKG/APT inspector
│ └── pacman.py # Pacman inspector │ └── pacman.py # Pacman inspector
├── completions/
│ ├── bash/
│ │ └── linux-backuper # Native Bash tab completion script
│ └── zsh/
│ └── _linux-backuper # Native Zsh tab completion function
├── packaging/ ├── packaging/
│ ├── build_packages.py # Standalone .deb, .rpm and .tar.gz generator │ ├── build_packages.py # Standalone .deb, .rpm and .tar.gz generator
│ ├── install.sh # Tarball installer script │ ├── install.sh # Tarball installer script
+6 -3
View File
@@ -78,14 +78,17 @@ This roadmap defines the implementation order for `linux-backuper` in thin, inde
--- ---
### Slice 8 — Full Documentation, Man Page, CLI Help & Gitea Actions CI/CD Workflow ### Slice 8 — Full Documentation, Man Page, CLI Help, Shell Tab Completion & Gitea Actions CI/CD Workflow
- **Goal:** Production-ready release automation and complete operator, admin, and developer documentation. - **Goal:** Production-ready release automation, complete documentation triad, man page, and native Bash/Zsh tab completion.
- **Components:** - **Components:**
- `docs/user-guide.md`: Comprehensive operator scenarios, routine backups, inspection, diffing, and single-file extracts. - `docs/user-guide.md`: Comprehensive operator scenarios, routine backups, inspection, diffing, and single-file extracts.
- `docs/admin-guide.md`: Automation via systemd timer/cron, `/etc/logrotate.d/` rule, monitoring JSON integration, and remote SFTP/NFS retention. - `docs/admin-guide.md`: Automation via systemd timer/cron, `/etc/logrotate.d/` rule, monitoring JSON integration, and remote SFTP/NFS retention.
- `docs/developer-guide.md`: Internal architecture, extending package/storage managers, and testing runbook. - `docs/developer-guide.md`: Internal architecture, extending package/storage managers, and testing runbook.
- `man/linux-backuper.8`: Full UNIX Section 8 man page (`man 8 linux-backuper`). - `man/linux-backuper.8`: Full UNIX Section 8 man page (`man 8 linux-backuper`).
- Shell Tab Completion: Native Bash (`completions/bash/linux-backuper`) and Zsh (`completions/zsh/_linux-backuper`) scripts supporting subcommands, flags, and dynamic snapshot ID completion.
- `linux-backuper completion [bash|zsh]` generator sub-command.
- Interactive CLI Help: Complete `-h` and `--help` for root and all sub-commands with usage examples. - Interactive CLI Help: Complete `-h` and `--help` for root and all sub-commands with usage examples.
- Packaging integration: Install completion scripts to `/usr/share/bash-completion/completions/` and `/usr/share/zsh/site-functions/`.
- `.gitea/workflows/release.yml`: Gitea Actions pipeline targeting `runs-on: fedora`, running tests, building `.rpm`/`.deb`, publishing to Gitea Package Registry and Release assets. - `.gitea/workflows/release.yml`: Gitea Actions pipeline targeting `runs-on: fedora`, running tests, building `.rpm`/`.deb`, publishing to Gitea Package Registry and Release assets.
- **Verification:** Unit tests verifying `linux-backuper -h` and each sub-command `--help` return exit code 0; man page syntax verified with `man -l man/linux-backuper.8`. - **Verification:** Unit tests verifying `linux-backuper -h`, sub-command `--help`, shell completion scripts generation (`linux-backuper completion bash` / `zsh`), and man page syntax verification with `man -l man/linux-backuper.8`.