0e7e824085
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.
29 lines
755 B
Fish
29 lines
755 B
Fish
# 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
|