gitui icon indicating copy to clipboard operation
gitui copied to clipboard

[feature] self update (gitui update)

Open shuppel opened this issue 6 months ago • 0 comments

This Pull Request closes any self-update-cli-command issue.

It changes the following:

  • Adds gitui update subcommand 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 / -n flag to include pre-release versions (nightly, rc, beta)
  • Filters stable vs pre-release versions so users can choose update stability
  • Adds short alias gitui -U for quick access to update command

I followed the checklist:

  • [x] I added unittests
  • [x] I ran make check without 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 interaction
  • detector.rs - Installation method detection
  • commands.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

shuppel avatar May 11 '26 15:05 shuppel