Compare commits

...

16 Commits

Author SHA1 Message Date
rootiest 0e766b3326 Merge pull request 'feat(deps): add fish-deps unified dependency management command' (#17) from feat/fish-deps into main
Reviewed-on: #17
2026-05-19 03:53:51 +00:00
rootiest a7510cc8ea fix(fish-deps): filter fish-* tags only; fix starship sh -s flag
git tag --list 'fish-*' replaces for-each-ref so old pre-Rust tags like
pre_whitespace_fix (which have no Cargo.toml) are never selected.

starship update: sh -s -- --yes correctly passes --yes to the piped
install script instead of treating it as a filename for sh to open.
2026-05-18 23:46:34 -04:00
rootiest a351e62a17 feat(fish-deps): add uv as managed dep; install before cargo and fish
uv is now listed first in the catalog (before cargo and fish) so it is
installed automatically before the fish source build is attempted.
Install uses the official curl script; update uses `uv self update`.

Catalog order is now: uv → cargo → fish → … ensuring prerequisites are
in place before any dependent install method runs.

README updated: uv and cargo added to the Required table, warning callout
and dependency management note reflect the automatic install flow.
2026-05-18 23:34:49 -04:00
rootiest 7936a0966e feat(fish-deps): build fish from source via git + cargo when upgrading
Adds a git-cargo-fish install method that clones fish-shell, checks out
the latest tag, and runs `uv run --no-managed-python cargo install --path .`.
This is offered first in `fish-deps install` (requires cargo + uv) and
used automatically by `fish-deps update`, falling back to the system PM
when cargo or uv are absent.

Removes the stale `cargo install fish` README note (that crate is a
library, not the shell binary).
2026-05-18 23:29:55 -04:00
rootiest fee2d99bea feat(fish-deps): warn on fish < 4.0 in status; prompt upgrade in install
fish-deps status now shows ⚠ with the current version when fish < 4.0.
fish-deps install prompts to upgrade fish when the installed version is
below 4.0, using the same install methods (cargo/PM) and printing a
restart reminder on success.
2026-05-18 23:17:51 -04:00
rootiest 7d4e33bc7e feat(deps): add curl installer for lazydocker and binary download for wakatime
lazydocker: prefer the official install_update_linux.sh curl script over
system PM. The same script handles updates, so fish-deps update re-runs it.

wakatime: replace pipx with a direct binary download from github releases.
Detects architecture (amd64/arm64/arm) via uname -m, downloads the zip,
extracts the binary to ~/.config/wakatime/wakatime, chmods it, and
symlinks it to ~/.local/bin/wakatime. fish-deps update re-downloads and
replaces the binary in place.

Both new specials are added to the preferred-method block so they appear
before the system PM and are the default when prompted.
2026-05-18 23:04:35 -04:00
rootiest 782ef833c2 fix(deps): correct trash cargo crate name to trashy 2026-05-18 22:48:33 -04:00
rootiest 8917442089 fix(deps): update PATH immediately after rustup install
After the rustup installer runs, add the cargo bin dir to PATH in the
current session so subsequent installs in the same fish-deps run can
find cargo without a shell restart. Checks CARGO_HOME/bin first (set
in config.fish), then falls back to the rustup default ~/.cargo/bin.
Warns the user if cargo still isn't detectable after the path update.
2026-05-18 22:40:35 -04:00
rootiest 8d9e7ae43f fix(deps): validate method choice is numeric before comparing 2026-05-18 22:29:50 -04:00
rootiest 9e7539d863 feat(deps): support upgrading fish itself via cargo install fish
Fish 4.x is a Rust rewrite published to crates.io as 'fish'. Added the
crate to the catalog so fish-deps update will run cargo install --force
fish to upgrade it. A yellow restart reminder is printed after the
upgrade since the new binary won't take effect until the shell restarts.

README warning updated to mention cargo install fish as the upgrade
path for users stuck on Fish 3.x.
2026-05-18 22:23:10 -04:00
rootiest 6fd1e3221e docs(readme): require Fish >= 4.0 and add Rust/cargo to dependencies 2026-05-18 22:20:16 -04:00
rootiest df7c921bc6 feat(deps): add cargo as a managed dependency with rustup installer
cargo is now the second entry in the catalog (after fish) so it is
installed before any Rust tool that depends on it. Install preference:
rustup installer (curl | sh) first, system PM as fallback. Update
runs rustup update when rustup is available.

The rustup-installer special is evaluated before the system PM in the
method list so it is always option 1 / the default for cargo.
2026-05-18 22:18:57 -04:00
rootiest abbbf20b40 fix(deps): restore paru install gated on pacman presence
On Arch-based systems (pacman present), paru-build offers yay or
makepkg as install methods. On non-Arch systems neither pacman nor yay
exist, so no methods are built and the dep is silently skipped — no
prompt shown to the user.
2026-05-18 22:14:45 -04:00
rootiest a70e88c344 fix(deps): remove paru install, enforce cargo preference for Rust tools
Catalog: clear paru's pm and special install entries so it appears in
status but fish-deps install skips it (it's a package manager, not a
managed dep).

Install: cargo is now always attempted first for Rust tools. When cargo
is absent but a crate exists, a note is printed suggesting rustup.
When only one method is available the chosen method is shown so the user
can see whether cargo or the system PM is being used. Method prompt now
shows the default label inline for clarity.

Removed dead paru-build switch case from the install executor.
2026-05-18 22:13:13 -04:00
rootiest a7c6b9097d fix(deps): consolidate install prompt into read -P to prevent display race 2026-05-18 22:07:50 -04:00
rootiest 0e7e824085 fix(deps): fix autoloading and Fish 4.x test compatibility
Split _fish_deps_pm.fish into one file per function so Fish can
autoload each by name (_fish_deps_detect_pm, _fish_deps_pm_install,
_fish_deps_pm_upgrade). A single file with multiple functions only
autoloads under the filename, leaving the others unreachable.

Replace all `test -a`/`test -o` binary operators with `; and`/`; or`
chains throughout _fish_deps_install and _fish_deps_update. Fish 4.x
removed support for -a/-o in test, causing the "unexpected argument"
errors seen on Debian.

Also consolidate paru/yay cases in pm_install and pm_upgrade since
both helpers use identical flags.
2026-05-18 22:05:56 -04:00
9 changed files with 352 additions and 111 deletions
+19 -9
View File
@@ -254,7 +254,10 @@ rm -f file.txt # Falls through to standard rm -f
| `fzf-update` | Install or upgrade fzf from git HEAD into `~/.fzf` (guarantees the latest build) | | `fzf-update` | Install or upgrade fzf from git HEAD into `~/.fzf` (guarantees the latest build) |
| `check_fish_deps` | Legacy alias — delegates to `fish-deps status` | | `check_fish_deps` | Legacy alias — delegates to `fish-deps status` |
Install method priority: **cargo** (for Rust tools, gets latest crate) → **system PM** (paru/apt/brew/etc.) → **git clone** (fzf) → **curl installer** (starship, fisher) → **pipx** (Python tools). When multiple methods are available for a tool, you are prompted to choose. Install method priority: **git+cargo source build** (fish) → **cargo** (other Rust tools, gets latest crate) → **system PM** (paru/apt/brew/etc.) → **git clone** (fzf) → **curl installer** (starship, fisher) → **pipx** (Python tools). When multiple methods are available for a tool, you are prompted to choose.
> [!NOTE]
> Upgrading Fish from source requires **cargo** and **[uv](https://docs.astral.sh/uv/)**. Both are managed dependencies — `fish-deps install` will offer to install them before attempting the Fish build. If both are unavailable, `fish-deps update` falls back to the system package manager.
### Docker ### Docker
@@ -491,19 +494,26 @@ Named context shortcuts (e.g. `dcr`, `dck`) live in `~/.config/.user-dots/fish/l
### Required ### Required
| Tool | Purpose | | Tool | Version | Purpose |
|---|---| |---|---|---|
| [Fish](https://fishshell.com/) | Shell | | [uv](https://docs.astral.sh/uv/) | any | Python runner (needed to build Fish from source) |
| [Fisher](https://github.com/jorgebucaran/fisher) | Plugin manager | | [Rust / cargo](https://www.rust-lang.org/tools/install) | any | Installs Rust-based tools; required to build Fish |
| [Starship](https://starship.rs/) | Prompt | | [Fish](https://fishshell.com/) | **≥ 4.0** | Shell |
| [fzf](https://github.com/junegunn/fzf) | Fuzzy finder | | [Fisher](https://github.com/jorgebucaran/fisher) | any | Plugin manager |
| [zoxide](https://github.com/ajeetdsouza/zoxide) | Smart directory jumper | | [Starship](https://starship.rs/) | any | Prompt |
| [direnv](https://direnv.net/) | Per-directory env loading | | [fzf](https://github.com/junegunn/fzf) | any | Fuzzy finder |
| [zoxide](https://github.com/ajeetdsouza/zoxide) | any | Smart directory jumper |
| [direnv](https://direnv.net/) | any | Per-directory env loading |
> [!WARNING]
> Fish **4.0 or newer is required.** This config uses `test` syntax and other constructs that are incompatible with Fish 3.x. Older versions will produce errors on startup.
> Run `fish-deps install` or `fish-deps update` to upgrade — it will install `uv` and `cargo` automatically if missing, then build the latest Fish from source.
### Recommended ### Recommended
| Tool | Replaces | | Tool | Replaces |
|---|---| |---|---|
| [Rust / cargo](https://www.rust-lang.org/tools/install) | Build tool for Rust-based CLI replacements below |
| [paru](https://github.com/Morganamilo/paru) / [yay](https://github.com/Jguer/yay) | AUR helper (Arch only) | | [paru](https://github.com/Morganamilo/paru) / [yay](https://github.com/Jguer/yay) | AUR helper (Arch only) |
| [eza](https://github.com/eza-community/eza) | `ls` (preferred) | | [eza](https://github.com/eza-community/eza) | `ls` (preferred) |
| [lsd](https://github.com/lsd-rs/lsd) | `ls` (fallback) | | [lsd](https://github.com/lsd-rs/lsd) | `ls` (fallback) |
+14 -11
View File
@@ -2,40 +2,43 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# Populates parallel arrays describing every managed dependency. # Populates parallel arrays describing every managed dependency.
# Callers must invoke this function before accessing _fdc_* variables. # Callers must invoke this function before accessing _fdc_* arrays.
# #
# Array layout (same index across all sets): # Array layout (same index across all sets):
# _fdc_bins — binary name (what `type -q` checks) # _fdc_bins — binary name (what `type -q` checks)
# _fdc_tiers — req | int | rec # _fdc_tiers — req | int | rec
# _fdc_cargo — cargo crate name, or "" if not on crates.io # _fdc_cargo — cargo crate name, or "" if not on crates.io
# _fdc_pm — system PM package name, or "" if not in repos # _fdc_pm — system PM package name, or "" if not in repos
# _fdc_special — special install key: fisher-bootstrap | fzf-update | # _fdc_special — special install key: rustup-installer | fisher-bootstrap |
# paru-build | pipx | curl-installer | "" (none) # fzf-update | paru-build | pipx | curl-installer |
# git-cargo-fish | curl-uv | "" (none)
#
# uv and cargo are listed first so both are available before fish and other Rust tools.
function _fish_deps_catalog function _fish_deps_catalog
set -g _fdc_bins \ set -g _fdc_bins \
fish fisher starship fzf zoxide direnv paru \ uv cargo fish fisher starship fzf zoxide direnv paru \
wakatime tailscale \ wakatime tailscale \
eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm
set -g _fdc_tiers \ set -g _fdc_tiers \
req req req req req req rec \ req req req req req req req req rec \
int int \ int int \
rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec rec
set -g _fdc_cargo \ set -g _fdc_cargo \
"" "" starship "" zoxide "" "" \ "" "" "" "" starship "" zoxide "" "" \
"" "" \ "" "" \
eza lsd bat "" du-dust "" "" "" ripgrep "" "" trash-cli "" "" eza lsd bat "" du-dust "" "" "" ripgrep "" "" trashy "" ""
set -g _fdc_pm \ set -g _fdc_pm \
fish "" starship fzf zoxide direnv paru \ uv cargo fish "" starship fzf zoxide direnv "" \
wakatime tailscale \ wakatime tailscale \
eza lsd bat btop dust duf prettyping most ripgrep lazygit lazydocker trash kitty wezterm eza lsd bat btop dust duf prettyping most ripgrep lazygit lazydocker trash kitty wezterm
set -g _fdc_special \ set -g _fdc_special \
"" fisher-bootstrap curl-installer fzf-update "" "" paru-build \ curl-uv rustup-installer git-cargo-fish fisher-bootstrap curl-installer fzf-update "" "" paru-build \
pipx "" \ wakatime-binary "" \
"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" ""
end end
# Returns the index (1-based) of $argv[1] in the catalog, or "" if not found. # Returns the index (1-based) of $argv[1] in the catalog, or "" if not found.
+13
View File
@@ -0,0 +1,13 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Detect the first available system package manager.
function _fish_deps_detect_pm
for pm in paru yay pacman apt brew pkg dnf yum
if type -q $pm
echo $pm
return
end
end
echo ""
end
+142 -18
View File
@@ -11,7 +11,20 @@ function _fish_deps_install
set -l i 1 set -l i 1
for bin in $_fdc_bins for bin in $_fdc_bins
# Determine if this dep needs attention: missing, or fish < 4.0
set -l needs_install 0
set -l upgrade_label Install
if not type -q $bin if not type -q $bin
set needs_install 1
else if test "$bin" = fish
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
if test -n "$_major"; and test "$_major" -lt 4
set needs_install 1
set upgrade_label "Upgrade"
end
end
if test $needs_install -eq 1
set -l cargo_crate $_fdc_cargo[$i] set -l cargo_crate $_fdc_cargo[$i]
set -l pm_pkg $_fdc_pm[$i] set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i] set -l special $_fdc_special[$i]
@@ -20,19 +33,53 @@ function _fish_deps_install
set -l methods set -l methods
set -l method_labels set -l method_labels
# Cargo — only if cargo is present and the tool has a crate # Cargo — preferred for Rust tools; gets the latest crate version
if test -n "$cargo_crate" -a (type -q cargo) if test -n "$cargo_crate"
set -a methods cargo if type -q cargo
set -a method_labels "cargo ($cargo_crate)" set -a methods cargo
set -a method_labels "cargo ($cargo_crate)"
else
set_color brblack
echo " note: cargo not found — install cargo first for the latest $bin"
set_color normal
end
end end
# System PM — only if a PM is detected and the tool is in repos # Preferred special methods — listed before system PM so they are the default
if test -n "$pm_pkg" -a -n "$pm" switch $special
case curl-uv
set -a methods special-uv
set -a method_labels "curl installer (official script)"
case git-cargo-fish
if type -q cargo; and type -q uv
set -a methods special-git-cargo-fish
set -a method_labels "build from source (git + cargo)"
else
set_color brblack
set -l _need
type -q cargo; or set -a _need cargo
type -q uv; or set -a _need uv
echo " note: "(string join " and " $_need)" not found — install them first to build fish from source"
set_color normal
end
case rustup-installer
set -a methods special-rustup
set -a method_labels "rustup installer (curl | sh)"
case curl-lazydocker
set -a methods special-lazydocker
set -a method_labels "curl installer (official script)"
case wakatime-binary
set -a methods special-wakatime
set -a method_labels "binary download (github releases)"
end
# System PM — after cargo and preferred specials
if test -n "$pm_pkg"; and test -n "$pm"
set -a methods pm set -a methods pm
set -a method_labels "$pm ($pm_pkg)" set -a method_labels "$pm ($pm_pkg)"
end end
# Special methods # Supplemental special methods (fallbacks, Arch-only, etc.)
switch $special switch $special
case fzf-update case fzf-update
set -a methods special-fzf set -a methods special-fzf
@@ -44,7 +91,7 @@ function _fish_deps_install
set -a methods special-curl set -a methods special-curl
set -a method_labels "curl installer" set -a method_labels "curl installer"
case paru-build case paru-build
# Only useful on Arch; skip if pacman not present # Only offered on Arch-based systems where pacman is present
if type -q yay if type -q yay
set -a methods special-yay-paru set -a methods special-yay-paru
set -a method_labels "yay -S paru" set -a method_labels "yay -S paru"
@@ -71,10 +118,9 @@ function _fish_deps_install
continue continue
end end
# Prompt: install this dep? # Prompt: install/upgrade this dep?
set_color cyan; echo -n "Install $bin? "; set_color normal read -l -P (set_color cyan)"$upgrade_label $bin?"(set_color normal)" [Y/n] " _reply
read -l -P "[Y/n] " _reply if test "$_reply" = n; or test "$_reply" = N
if test "$_reply" = n -o "$_reply" = N
set i (math $i + 1) set i (math $i + 1)
continue continue
end end
@@ -85,13 +131,16 @@ function _fish_deps_install
echo " Available methods:" echo " Available methods:"
set -l m 1 set -l m 1
for lbl in $method_labels for lbl in $method_labels
echo " $m) $lbl" set_color brblack; echo -n " $m) "; set_color normal
echo $lbl
set m (math $m + 1) set m (math $m + 1)
end end
read -l -P " Choose [1-"(count $methods)"] (default 1): " _choice read -l -P " Choose [1-"(count $methods)"] (default 1 = $method_labels[1]): " _choice
if test -n "$_choice" -a "$_choice" -ge 1 -a "$_choice" -le (count $methods) 2>/dev/null if string match -qr '^\d+$' "$_choice"; and test "$_choice" -ge 1; and test "$_choice" -le (count $methods)
set chosen_method $methods[$_choice] set chosen_method $methods[$_choice]
end end
else
set_color brblack; echo " "(string lower $upgrade_label)"ing via $method_labels[1]"; set_color normal
end end
# Execute chosen method # Execute chosen method
@@ -100,13 +149,54 @@ function _fish_deps_install
cargo install $cargo_crate cargo install $cargo_crate
case pm case pm
_fish_deps_pm_install $pm_pkg _fish_deps_pm_install $pm_pkg
case special-rustup
curl https://sh.rustup.rs -sSf | sh
# Add cargo to PATH for the rest of this session without restarting.
# Try CARGO_HOME first (set in config.fish), then the rustup default.
for _d in "$CARGO_HOME/bin" "$HOME/.cargo/bin"
if test -d "$_d"
fish_add_path "$_d"
break
end
end
if not type -q cargo
set_color yellow
echo " cargo not yet in PATH — restart your shell if subsequent installs fail."
set_color normal
end
case special-lazydocker
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
case special-wakatime
set -l _arch (uname -m)
switch $_arch
case x86_64
set _arch amd64
case aarch64 arm64
set _arch arm64
case armv7l
set _arch arm
case '*'
set _arch amd64
end
set -l _zip "wakatime-cli-linux-$_arch.zip"
set -l _bin_src "wakatime-cli-linux-$_arch"
set -l _wt_dir "$HOME/.config/wakatime"
set -l _wt_bin "$_wt_dir/wakatime"
set -l _tmpdir (mktemp -d)
curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \
-o "$_tmpdir/$_zip"
and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir"
and mkdir -p "$_wt_dir" "$HOME/.local/bin"
and cp "$_tmpdir/$_bin_src" "$_wt_bin"
and chmod +x "$_wt_bin"
and ln -sf "$_wt_bin" "$HOME/.local/bin/wakatime"
rm -rf "$_tmpdir"
case special-fzf case special-fzf
fzf-update fzf-update
case special-fisher case special-fisher
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source
fisher update fisher update
case special-curl case special-curl
# Currently used for starship
if test "$bin" = starship if test "$bin" = starship
curl -sS https://starship.rs/install.sh | sh curl -sS https://starship.rs/install.sh | sh
end end
@@ -119,6 +209,35 @@ function _fish_deps_install
and makepkg -si --noconfirm and makepkg -si --noconfirm
and popd and popd
rm -rf $_build_dir rm -rf $_build_dir
case special-uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Add uv to PATH for the rest of this session
for _d in "$HOME/.local/bin" "$HOME/.cargo/bin"
if test -d "$_d"
fish_add_path "$_d"
break
end
end
if not type -q uv
set_color yellow
echo " uv not yet in PATH — restart your shell if subsequent installs fail."
set_color normal
end
case special-git-cargo-fish
set -l _tmpdir (mktemp -d)
set -l _build_ok 0
git clone https://github.com/fish-shell/fish-shell "$_tmpdir"
and begin
set -l _tag (git -C "$_tmpdir" tag --list 'fish-*' --sort=version:refname | tail -1)
test -n "$_tag"; and git -C "$_tmpdir" checkout "$_tag"
true
end
and pushd "$_tmpdir"
and uv run --no-managed-python cargo install --path .
and set _build_ok 1
popd 2>/dev/null
rm -rf "$_tmpdir"
test $_build_ok -eq 1
case special-pipx case special-pipx
pipx install $bin pipx install $bin
case special-pip case special-pip
@@ -127,9 +246,14 @@ function _fish_deps_install
if test $status -eq 0 if test $status -eq 0
set installed_any 1 set installed_any 1
set_color green; echo " $bin installed."; set_color normal set_color green; echo " $bin "(string lower $upgrade_label)"ed."; set_color normal
if test "$bin" = fish
set_color yellow
echo " Fish upgraded — restart your shell to use the new version."
set_color normal
end
else else
set_color red; echo " $bin install failed."; set_color normal set_color red; echo " $bin "(string lower $upgrade_label)" failed."; set_color normal
end end
end end
set i (math $i + 1) set i (math $i + 1)
-69
View File
@@ -1,69 +0,0 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Detect the first available system package manager.
function _fish_deps_detect_pm
for pm in paru yay pacman apt brew pkg dnf yum
if type -q $pm
echo $pm
return
end
end
echo ""
end
# Install a package via the system PM.
# Usage: _fish_deps_pm_install <pkg>
function _fish_deps_pm_install --argument-names pkg
set -l pm (_fish_deps_detect_pm)
if test -z "$pm"
echo "No supported package manager found." >&2
return 1
end
switch $pm
case paru
paru -S --noconfirm $pkg
case yay
yay -S --noconfirm $pkg
case pacman
sudo pacman -S --noconfirm $pkg
case apt
sudo apt install -y $pkg
case brew
brew install $pkg
case pkg
sudo pkg install -y $pkg
case dnf
sudo dnf install -y $pkg
case yum
sudo yum install -y $pkg
end
end
# Upgrade an already-installed package via the system PM.
# Usage: _fish_deps_pm_upgrade <pkg>
function _fish_deps_pm_upgrade --argument-names pkg
set -l pm (_fish_deps_detect_pm)
if test -z "$pm"
echo "No supported package manager found." >&2
return 1
end
switch $pm
case paru
paru -S --noconfirm $pkg
case yay
yay -S --noconfirm $pkg
case pacman
sudo pacman -S --noconfirm $pkg
case apt
sudo apt install --only-upgrade -y $pkg
case brew
brew upgrade $pkg
case pkg
sudo pkg upgrade -y $pkg
case dnf
sudo dnf upgrade -y $pkg
case yum
sudo yum update -y $pkg
end
end
+28
View File
@@ -0,0 +1,28 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Install a package via the system PM.
# Usage: _fish_deps_pm_install <pkg>
function _fish_deps_pm_install --argument-names pkg
set -l pm (_fish_deps_detect_pm)
if test -z "$pm"
echo "No supported package manager found." >&2
return 1
end
switch $pm
case paru yay
$pm -S --noconfirm $pkg
case pacman
sudo pacman -S --noconfirm $pkg
case apt
sudo apt install -y $pkg
case brew
brew install $pkg
case pkg
sudo pkg install -y $pkg
case dnf
sudo dnf install -y $pkg
case yum
sudo yum install -y $pkg
end
end
+28
View File
@@ -0,0 +1,28 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Upgrade an already-installed package via the system PM.
# Usage: _fish_deps_pm_upgrade <pkg>
function _fish_deps_pm_upgrade --argument-names pkg
set -l pm (_fish_deps_detect_pm)
if test -z "$pm"
echo "No supported package manager found." >&2
return 1
end
switch $pm
case paru yay
$pm -S --noconfirm $pkg
case pacman
sudo pacman -S --noconfirm $pkg
case apt
sudo apt install --only-upgrade -y $pkg
case brew
brew upgrade $pkg
case pkg
sudo pkg upgrade -y $pkg
case dnf
sudo dnf upgrade -y $pkg
case yum
sudo yum update -y $pkg
end
end
+11
View File
@@ -7,6 +7,17 @@ function _fish_deps_status
function __fds_print_dep --argument-names bin tier function __fds_print_dep --argument-names bin tier
if type -q $bin if type -q $bin
# Special version check: fish < 4.0 is functionally incompatible
if test "$bin" = fish
set -l _major (fish --version 2>&1 | string match -r 'version (\d+)')[2]
if test -n "$_major"; and test "$_major" -lt 4
set -l _ver (fish --version 2>&1 | string replace 'fish, ' '')
set_color yellow; echo -n " ⚠ "; set_color normal
echo -n "$bin "
set_color brblack; echo "($_ver — upgrade to 4.0+ required)"; set_color normal
return
end
end
set_color green; echo -n " ✓ "; set_color normal set_color green; echo -n " ✓ "; set_color normal
echo -n "$bin " echo -n "$bin "
set_color brblack; echo "(Found at "(type -p $bin)")"; set_color normal set_color brblack; echo "(Found at "(type -p $bin)")"; set_color normal
+97 -4
View File
@@ -19,7 +19,7 @@ function _fish_deps_update
set -l i 1 set -l i 1
for bin in $_fdc_bins for bin in $_fdc_bins
# Skip fisher itself (handled above) and tools that aren't installed # Skip fisher itself (handled above) and tools that aren't installed
if test "$bin" = fisher -o not (type -q $bin) if test "$bin" = fisher; or not type -q $bin
set i (math $i + 1) set i (math $i + 1)
continue continue
end end
@@ -28,6 +28,17 @@ function _fish_deps_update
set -l pm_pkg $_fdc_pm[$i] set -l pm_pkg $_fdc_pm[$i]
set -l special $_fdc_special[$i] set -l special $_fdc_special[$i]
# cargo: update via rustup
if test "$special" = rustup-installer
if type -q rustup
echo "Updating $bin..."
rustup update
set updated_any 1
end
set i (math $i + 1)
continue
end
# fzf: always use fzf-update (git-based) # fzf: always use fzf-update (git-based)
if test "$special" = fzf-update if test "$special" = fzf-update
echo "Updating $bin..." echo "Updating $bin..."
@@ -37,6 +48,40 @@ function _fish_deps_update
continue continue
end end
# lazydocker: re-run the official install/update script
if test "$special" = curl-lazydocker
echo "Updating $bin..."
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
set updated_any 1
set i (math $i + 1)
continue
end
# wakatime: re-download the binary from github releases
if test "$special" = wakatime-binary
echo "Updating $bin..."
set -l _arch (uname -m)
switch $_arch
case x86_64; set _arch amd64
case aarch64 arm64; set _arch arm64
case armv7l; set _arch arm
case '*'; set _arch amd64
end
set -l _zip "wakatime-cli-linux-$_arch.zip"
set -l _bin_src "wakatime-cli-linux-$_arch"
set -l _wt_bin "$HOME/.config/wakatime/wakatime"
set -l _tmpdir (mktemp -d)
curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \
-o "$_tmpdir/$_zip"
and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir"
and cp "$_tmpdir/$_bin_src" "$_wt_bin"
and chmod +x "$_wt_bin"
rm -rf "$_tmpdir"
and set updated_any 1
set i (math $i + 1)
continue
end
# pipx tools # pipx tools
if test "$special" = pipx if test "$special" = pipx
if type -q pipx if type -q pipx
@@ -48,11 +93,59 @@ function _fish_deps_update
continue continue
end end
# uv: use built-in self-updater
if test "$special" = curl-uv
echo "Updating $bin..."
uv self update
set updated_any 1
set i (math $i + 1)
continue
end
# fish: prefer build from source via git + cargo; fall back to PM
if test "$special" = git-cargo-fish
if type -q cargo; and type -q uv
echo "Updating $bin..."
set -l _tmpdir (mktemp -d)
set -l _build_ok 0
git clone https://github.com/fish-shell/fish-shell "$_tmpdir"
and begin
set -l _tag (git -C "$_tmpdir" tag --list 'fish-*' --sort=version:refname | tail -1)
test -n "$_tag"; and git -C "$_tmpdir" checkout "$_tag"
true
end
and pushd "$_tmpdir"
and uv run --no-managed-python cargo install --path .
and set _build_ok 1
popd 2>/dev/null
rm -rf "$_tmpdir"
if test $_build_ok -eq 1
set updated_any 1
set_color yellow
echo " Fish updated — restart your shell to use the new version."
set_color normal
end
else if test -n "$pm_pkg"; and test -n "$pm"
echo "Updating $bin (cargo/uv unavailable, using system PM)..."
_fish_deps_pm_upgrade $pm_pkg
set updated_any 1
set_color yellow
echo " Fish updated — restart your shell to use the new version."
set_color normal
else
set_color yellow
echo " fish: cannot update — install cargo and uv to build from source"
set_color normal
end
set i (math $i + 1)
continue
end
# curl-installer tools (starship etc.): re-run install script, which upgrades in place # curl-installer tools (starship etc.): re-run install script, which upgrades in place
if test "$special" = curl-installer if test "$special" = curl-installer
if test "$bin" = starship if test "$bin" = starship
echo "Updating $bin..." echo "Updating $bin..."
curl -sS https://starship.rs/install.sh | sh -- --yes curl -sS https://starship.rs/install.sh | sh -s -- --yes
set updated_any 1 set updated_any 1
end end
set i (math $i + 1) set i (math $i + 1)
@@ -60,7 +153,7 @@ function _fish_deps_update
end end
# Cargo: prefer for Rust tools # Cargo: prefer for Rust tools
if test -n "$cargo_crate" -a (type -q cargo) if test -n "$cargo_crate"; and type -q cargo
echo "Updating $bin..." echo "Updating $bin..."
cargo install --force $cargo_crate cargo install --force $cargo_crate
set updated_any 1 set updated_any 1
@@ -69,7 +162,7 @@ function _fish_deps_update
end end
# System PM fallback # System PM fallback
if test -n "$pm_pkg" -a -n "$pm" if test -n "$pm_pkg"; and test -n "$pm"
echo "Updating $bin..." echo "Updating $bin..."
_fish_deps_pm_upgrade $pm_pkg _fish_deps_pm_upgrade $pm_pkg
set updated_any 1 set updated_any 1