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.
This commit is contained in:
2026-05-18 22:18:57 -04:00
parent abbbf20b40
commit df7c921bc6
3 changed files with 33 additions and 12 deletions
+10 -8
View File
@@ -2,38 +2,40 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# 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):
# _fdc_bins — binary name (what `type -q` checks)
# _fdc_tiers — req | int | rec
# _fdc_cargo — cargo crate name, or "" if not on crates.io
# _fdc_pm — system PM package name, or "" if not in repos
# _fdc_special — special install key: fisher-bootstrap | fzf-update |
# pipx | curl-installer | "" (none)
# _fdc_special — special install key: rustup-installer | fisher-bootstrap |
# fzf-update | paru-build | pipx | curl-installer | "" (none)
#
# cargo is listed second so it is installed before Rust tools that depend on it.
function _fish_deps_catalog
set -g _fdc_bins \
fish fisher starship fzf zoxide direnv paru \
fish cargo fisher starship fzf zoxide direnv paru \
wakatime tailscale \
eza lsd bat btop dust duf prettyping most rg lazygit lazydocker trash kitty wezterm
set -g _fdc_tiers \
req req req req req req rec \
req req req req req req req rec \
int int \
rec rec rec rec rec rec rec rec rec rec rec rec rec rec
set -g _fdc_cargo \
"" "" starship "" zoxide "" "" \
"" "" "" starship "" zoxide "" "" \
"" "" \
eza lsd bat "" du-dust "" "" "" ripgrep "" "" trash-cli "" ""
set -g _fdc_pm \
fish "" starship fzf zoxide direnv "" \
fish cargo "" starship fzf zoxide direnv "" \
wakatime tailscale \
eza lsd bat btop dust duf prettyping most ripgrep lazygit lazydocker trash kitty wezterm
set -g _fdc_special \
"" fisher-bootstrap curl-installer fzf-update "" "" paru-build \
"" rustup-installer fisher-bootstrap curl-installer fzf-update "" "" paru-build \
pipx "" \
"" "" "" "" "" "" "" "" "" "" "" "" "" ""
end
+12 -4
View File
@@ -20,25 +20,31 @@ function _fish_deps_install
set -l methods
set -l method_labels
# Cargo first — preferred for Rust tools; gets the latest crate version
# Cargo — preferred for Rust tools; gets the latest crate version
if test -n "$cargo_crate"
if type -q cargo
set -a methods cargo
set -a method_labels "cargo ($cargo_crate)"
else
set_color brblack
echo " note: cargo not found — install rustup for the latest $bin"
echo " note: cargo not found — install cargo first for the latest $bin"
set_color normal
end
end
# System PM — after cargo so cargo is always the default when available
# rustup installer — listed before system PM so it is the default for cargo itself
if test "$special" = rustup-installer
set -a methods special-rustup
set -a method_labels "rustup installer (curl | sh)"
end
# System PM — after cargo/rustup so those are always the default when available
if test -n "$pm_pkg"; and test -n "$pm"
set -a methods pm
set -a method_labels "$pm ($pm_pkg)"
end
# Special methods
# Remaining special methods
switch $special
case fzf-update
set -a methods special-fzf
@@ -108,6 +114,8 @@ function _fish_deps_install
cargo install $cargo_crate
case pm
_fish_deps_pm_install $pm_pkg
case special-rustup
curl https://sh.rustup.rs -sSf | sh
case special-fzf
fzf-update
case special-fisher
+11
View File
@@ -28,6 +28,17 @@ function _fish_deps_update
set -l pm_pkg $_fdc_pm[$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)
if test "$special" = fzf-update
echo "Updating $bin..."