Compare commits
16 Commits
a3d99eec3f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e766b3326 | |||
|
a7510cc8ea
|
|||
|
a351e62a17
|
|||
|
7936a0966e
|
|||
|
fee2d99bea
|
|||
|
7d4e33bc7e
|
|||
|
782ef833c2
|
|||
|
8917442089
|
|||
|
8d9e7ae43f
|
|||
|
9e7539d863
|
|||
|
6fd1e3221e
|
|||
|
df7c921bc6
|
|||
|
abbbf20b40
|
|||
|
a70e88c344
|
|||
|
a7c6b9097d
|
|||
|
0e7e824085
|
@@ -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) |
|
||||
| `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
|
||||
|
||||
@@ -491,19 +494,26 @@ Named context shortcuts (e.g. `dcr`, `dck`) live in `~/.config/.user-dots/fish/l
|
||||
|
||||
### Required
|
||||
|
||||
| Tool | Purpose |
|
||||
|---|---|
|
||||
| [Fish](https://fishshell.com/) | Shell |
|
||||
| [Fisher](https://github.com/jorgebucaran/fisher) | Plugin manager |
|
||||
| [Starship](https://starship.rs/) | Prompt |
|
||||
| [fzf](https://github.com/junegunn/fzf) | Fuzzy finder |
|
||||
| [zoxide](https://github.com/ajeetdsouza/zoxide) | Smart directory jumper |
|
||||
| [direnv](https://direnv.net/) | Per-directory env loading |
|
||||
| Tool | Version | Purpose |
|
||||
|---|---|---|
|
||||
| [uv](https://docs.astral.sh/uv/) | any | Python runner (needed to build Fish from source) |
|
||||
| [Rust / cargo](https://www.rust-lang.org/tools/install) | any | Installs Rust-based tools; required to build Fish |
|
||||
| [Fish](https://fishshell.com/) | **≥ 4.0** | Shell |
|
||||
| [Fisher](https://github.com/jorgebucaran/fisher) | any | Plugin manager |
|
||||
| [Starship](https://starship.rs/) | any | Prompt |
|
||||
| [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
|
||||
|
||||
| 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) |
|
||||
| [eza](https://github.com/eza-community/eza) | `ls` (preferred) |
|
||||
| [lsd](https://github.com/lsd-rs/lsd) | `ls` (fallback) |
|
||||
|
||||
@@ -2,40 +2,43 @@
|
||||
# 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 |
|
||||
# paru-build | pipx | curl-installer | "" (none)
|
||||
# _fdc_special — special install key: rustup-installer | fisher-bootstrap |
|
||||
# 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
|
||||
set -g _fdc_bins \
|
||||
fish fisher starship fzf zoxide direnv paru \
|
||||
uv cargo fish 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 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 "" ""
|
||||
eza lsd bat "" du-dust "" "" "" ripgrep "" "" trashy "" ""
|
||||
|
||||
set -g _fdc_pm \
|
||||
fish "" starship fzf zoxide direnv paru \
|
||||
uv cargo fish "" 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 \
|
||||
pipx "" \
|
||||
"" "" "" "" "" "" "" "" "" "" "" "" "" ""
|
||||
curl-uv rustup-installer git-cargo-fish fisher-bootstrap curl-installer fzf-update "" "" paru-build \
|
||||
wakatime-binary "" \
|
||||
"" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" ""
|
||||
end
|
||||
|
||||
# Returns the index (1-based) of $argv[1] in the catalog, or "" if not found.
|
||||
|
||||
@@ -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
|
||||
@@ -11,7 +11,20 @@ function _fish_deps_install
|
||||
|
||||
set -l i 1
|
||||
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
|
||||
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 pm_pkg $_fdc_pm[$i]
|
||||
set -l special $_fdc_special[$i]
|
||||
@@ -20,19 +33,53 @@ function _fish_deps_install
|
||||
set -l methods
|
||||
set -l method_labels
|
||||
|
||||
# Cargo — only if cargo is present and the tool has a crate
|
||||
if test -n "$cargo_crate" -a (type -q cargo)
|
||||
set -a methods cargo
|
||||
set -a method_labels "cargo ($cargo_crate)"
|
||||
# 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 cargo first for the latest $bin"
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
# System PM — only if a PM is detected and the tool is in repos
|
||||
if test -n "$pm_pkg" -a -n "$pm"
|
||||
# Preferred special methods — listed before system PM so they are the default
|
||||
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 method_labels "$pm ($pm_pkg)"
|
||||
end
|
||||
|
||||
# Special methods
|
||||
# Supplemental special methods (fallbacks, Arch-only, etc.)
|
||||
switch $special
|
||||
case fzf-update
|
||||
set -a methods special-fzf
|
||||
@@ -44,7 +91,7 @@ function _fish_deps_install
|
||||
set -a methods special-curl
|
||||
set -a method_labels "curl installer"
|
||||
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
|
||||
set -a methods special-yay-paru
|
||||
set -a method_labels "yay -S paru"
|
||||
@@ -71,10 +118,9 @@ function _fish_deps_install
|
||||
continue
|
||||
end
|
||||
|
||||
# Prompt: install this dep?
|
||||
set_color cyan; echo -n "Install $bin? "; set_color normal
|
||||
read -l -P "[Y/n] " _reply
|
||||
if test "$_reply" = n -o "$_reply" = N
|
||||
# Prompt: install/upgrade this dep?
|
||||
read -l -P (set_color cyan)"$upgrade_label $bin?"(set_color normal)" [Y/n] " _reply
|
||||
if test "$_reply" = n; or test "$_reply" = N
|
||||
set i (math $i + 1)
|
||||
continue
|
||||
end
|
||||
@@ -85,13 +131,16 @@ function _fish_deps_install
|
||||
echo " Available methods:"
|
||||
set -l m 1
|
||||
for lbl in $method_labels
|
||||
echo " $m) $lbl"
|
||||
set_color brblack; echo -n " $m) "; set_color normal
|
||||
echo $lbl
|
||||
set m (math $m + 1)
|
||||
end
|
||||
read -l -P " Choose [1-"(count $methods)"] (default 1): " _choice
|
||||
if test -n "$_choice" -a "$_choice" -ge 1 -a "$_choice" -le (count $methods) 2>/dev/null
|
||||
read -l -P " Choose [1-"(count $methods)"] (default 1 = $method_labels[1]): " _choice
|
||||
if string match -qr '^\d+$' "$_choice"; and test "$_choice" -ge 1; and test "$_choice" -le (count $methods)
|
||||
set chosen_method $methods[$_choice]
|
||||
end
|
||||
else
|
||||
set_color brblack; echo " "(string lower $upgrade_label)"ing via $method_labels[1]"; set_color normal
|
||||
end
|
||||
|
||||
# Execute chosen method
|
||||
@@ -100,13 +149,54 @@ 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
|
||||
# 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
|
||||
fzf-update
|
||||
case special-fisher
|
||||
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source
|
||||
fisher update
|
||||
case special-curl
|
||||
# Currently used for starship
|
||||
if test "$bin" = starship
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
end
|
||||
@@ -119,6 +209,35 @@ function _fish_deps_install
|
||||
and makepkg -si --noconfirm
|
||||
and popd
|
||||
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
|
||||
pipx install $bin
|
||||
case special-pip
|
||||
@@ -127,9 +246,14 @@ function _fish_deps_install
|
||||
|
||||
if test $status -eq 0
|
||||
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
|
||||
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
|
||||
set i (math $i + 1)
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -7,6 +7,17 @@ function _fish_deps_status
|
||||
|
||||
function __fds_print_dep --argument-names bin tier
|
||||
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
|
||||
echo -n "$bin "
|
||||
set_color brblack; echo "(Found at "(type -p $bin)")"; set_color normal
|
||||
|
||||
@@ -19,7 +19,7 @@ function _fish_deps_update
|
||||
set -l i 1
|
||||
for bin in $_fdc_bins
|
||||
# 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)
|
||||
continue
|
||||
end
|
||||
@@ -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..."
|
||||
@@ -37,6 +48,40 @@ function _fish_deps_update
|
||||
continue
|
||||
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
|
||||
if test "$special" = pipx
|
||||
if type -q pipx
|
||||
@@ -48,11 +93,59 @@ function _fish_deps_update
|
||||
continue
|
||||
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
|
||||
if test "$special" = curl-installer
|
||||
if test "$bin" = starship
|
||||
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
|
||||
end
|
||||
set i (math $i + 1)
|
||||
@@ -60,7 +153,7 @@ function _fish_deps_update
|
||||
end
|
||||
|
||||
# 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..."
|
||||
cargo install --force $cargo_crate
|
||||
set updated_any 1
|
||||
@@ -69,7 +162,7 @@ function _fish_deps_update
|
||||
end
|
||||
|
||||
# System PM fallback
|
||||
if test -n "$pm_pkg" -a -n "$pm"
|
||||
if test -n "$pm_pkg"; and test -n "$pm"
|
||||
echo "Updating $bin..."
|
||||
_fish_deps_pm_upgrade $pm_pkg
|
||||
set updated_any 1
|
||||
|
||||
Reference in New Issue
Block a user