00055a7c38
Refactor pkg.fish to auto-detect the system package manager via _fish_deps_detect_pm instead of hard-requiring paru/yay. Supports install, uninstall, and auto (toggle) modes across paru, yay, pacman, apt, dnf, zypper, yum, brew, and pkg. Package installed-checks now use the correct query tool per PM (pacman -Qi, dpkg -s, rpm -q, etc.). Also adds zypper to the _fish_deps_detect_pm detection priority list.
23 lines
566 B
Fish
23 lines
566 B
Fish
# Copyright (C) 2026 Rootiest
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# SYNOPSIS
|
|
# _fish_deps_detect_pm
|
|
#
|
|
# DESCRIPTION
|
|
# Detects and prints the name of the first available system package manager
|
|
# from the priority list: paru, yay, pacman, apt, brew, pkg, dnf, zypper, yum.
|
|
# Prints an empty string if none are found.
|
|
#
|
|
# EXAMPLE
|
|
# set pm (_fish_deps_detect_pm)
|
|
function _fish_deps_detect_pm
|
|
for pm in paru yay pacman apt brew pkg dnf zypper yum
|
|
if type -q $pm
|
|
echo $pm
|
|
return
|
|
end
|
|
end
|
|
echo ""
|
|
end
|