Files
fish-config/functions/_fish_deps_status.fish
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

51 lines
1.9 KiB
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# Print colored installed/missing status for all deps, grouped by tier.
function _fish_deps_status
_fish_deps_catalog
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
else if test "$tier" = rec
set_color yellow; echo -n " ⚠ "; set_color normal
echo -n "$bin "
set_color brblack; echo "(Not installed)"; set_color normal
else
set_color red; echo -n " ✗ "; set_color normal
echo -n "$bin "
set_color brblack; echo "(Not installed)"; set_color normal
end
end
for tier_label in "Required Dependencies:req" "Integrations:int" "Recommended Dependencies:rec"
set -l label (string split : $tier_label)[1]
set -l tier (string split : $tier_label)[2]
set_color cyan; echo $label; set_color normal
set -l i 1
for bin in $_fdc_bins
if test "$_fdc_tiers[$i]" = $tier
__fds_print_dep $bin $tier
end
set i (math $i + 1)
end
echo ""
end
functions -e __fds_print_dep
end