gitui
gitui copied to clipboard
[feature] self update (gitui update)
This Pull Request closes any self-update-cli-command issue.
It changes the following:
- Adds
gitui updatesubcommand for self-updating via CLI (before opening TUI) - Supports updating via multiple package managers: cargo, dnf, apt, pacman, homebrew, scoop, chocolatey
- Detects installation method automatically by examining binary path and querying system package managers
- Supports
--nightly/-nflag to include pre-release versions (nightly, rc, beta) - Filters stable vs pre-release versions so users can choose update stability
- Adds short alias
gitui -Ufor quick access to update command
I followed the checklist:
- [x] I added unittests
- [x] I ran
make checkwithout errors - [x] I tested the overall application
- [x] I added an appropriate item to the changelog
Testing Performed
Tested on Fedora 42 with DNF-installed gitui:
./target/release/gitui update- Detects DNF, checks versions, prompts for update./target/release/gitui update -n- Includes pre-release versions in update check./target/release/gitui -U- Short alias works correctly
Module Structure
Created modular update system in src/update/:
mod.rs- Orchestrates update flow, version checking, user interactiondetector.rs- Installation method detectioncommands.rs- Update command execution using macro
Example Usage
# Update to latest stable
$ gitui update
gitui version: 0.28.1-nightly
Installation method: dnf
Update available: 0.28.1-nightly -> 0.28.1
Do you want to update gitui? [y/N]: y
Successfully updated via dnf!
# Update including pre-releases
$ gitui update -n
⚠️ Pre-release update available: 0.28.1-nightly -> 0.28.1-rc.1