[+] Implement --package_separate flag

#135
This commit is contained in:
Azalea 2023-07-23 14:20:27 -07:00
parent 8e63a77335
commit cf83073200

View file

@ -214,6 +214,18 @@ mem_precision=2
package_managers="on" package_managers="on"
# Show separate user and system packages for supported package managers
#
# Default: 'on'
# Values: 'on', 'off'
# Flag: --package_separate
#
# Example:
# on: '8 packages (flatpak-system), 9 packages (flatpak-user)'
# off: '17 packages (flatpak)'
package_separate="on"
# Shell # Shell
@ -2041,21 +2053,52 @@ get_packages() {
# Other (Needs complex command) # Other (Needs complex command)
has kpm-pkg && ((packages+=$(kpm --get-selections | grep -cv deinstall$))) has kpm-pkg && ((packages+=$(kpm --get-selections | grep -cv deinstall$)))
has guix && { # Separate system and user packages
manager=guix-system && tot guix package -p /run/current-system/profile -I if [[ $package_separate == on ]]; then
manager=guix-user && tot guix package -I has guix && {
manager=guix-home && tot guix package -p ~/.guix-home/profile -I manager=guix-system && tot guix package -p /run/current-system/profile -I
} manager=guix-user && tot guix package -I
manager=guix-home && tot guix package -p ~/.guix-home/profile -I
has nix-store && {
nix-user-pkgs() {
nix-store -qR ~/.nix-profile
nix-store -qR /etc/profiles/per-user/"$USER"
} }
manager=nix-system && tot nix-store -qR /run/current-system/sw
manager=nix-user && tot nix-user-pkgs has nix-store && {
manager=nix-default && tot nix-store -qR /nix/var/nix/profiles/default nix-user-pkgs() {
} nix-store -qR ~/.nix-profile
nix-store -qR /etc/profiles/per-user/"$USER"
}
manager=nix-system && tot nix-store -qR /run/current-system/sw
manager=nix-user && tot nix-user-pkgs
manager=nix-default && tot nix-store -qR /nix/var/nix/profiles/default
}
has flatpak && {
manager=flatpak-system && tot flatpak list --system
manager=flatpak-user && tot flatpak list --user
}
else
has guix && {
guix-all() {
guix package -p /run/current-system/profile -I
guix package -I
guix package -p ~/.guix-home/profile -I
}
manager=guix && tot guix-all
}
has nix-store && {
nix-all() {
nix-store -qR ~/.nix-profile
nix-store -qR /etc/profiles/per-user/"$USER"
nix-store -qR /run/current-system/sw
nix-store -qR /nix/var/nix/profiles/default
}
manager=nix && tot nix-all
}
has flatpak && {
manager=flatpak && tot flatpak list
}
fi
# pkginfo is also the name of a python package manager which is painfully slow. # pkginfo is also the name of a python package manager which is painfully slow.
# TODO: Fix this somehow. # TODO: Fix this somehow.
@ -2079,10 +2122,6 @@ get_packages() {
esac esac
# List these last as they accompany regular package managers. # List these last as they accompany regular package managers.
has flatpak && {
manager=flatpak-system && tot flatpak list --system
manager=flatpak-user && tot flatpak list --user
}
has spm && tot spm list -i has spm && tot spm list -i
has puyo && dir ~/.puyo/installed has puyo && dir ~/.puyo/installed
@ -6072,6 +6111,7 @@ INFO:
--title_fqdn on/off Hide/Show Fully Qualified Domain Name in title. --title_fqdn on/off Hide/Show Fully Qualified Domain Name in title.
--package_managers on/off Hide/Show Package Manager names. (on, tiny, off) --package_managers on/off Hide/Show Package Manager names. (on, tiny, off)
--package_separate on/off Whether to separate system/user modes for supported package managers
--os_arch on/off Hide/Show OS architecture. --os_arch on/off Hide/Show OS architecture.
--speed_type type Change the type of cpu speed to display. --speed_type type Change the type of cpu speed to display.
Possible values: current, min, max, bios, Possible values: current, min, max, bios,
@ -6332,6 +6372,7 @@ get_args() {
# Info # Info
"--title_fqdn") title_fqdn="$2" ;; "--title_fqdn") title_fqdn="$2" ;;
"--package_managers") package_managers="$2" ;; "--package_managers") package_managers="$2" ;;
"--package_separate") package_separate="$2" ;;
"--os_arch") os_arch="$2" ;; "--os_arch") os_arch="$2" ;;
"--cpu_cores") cpu_cores="$2" ;; "--cpu_cores") cpu_cores="$2" ;;
"--cpu_speed") cpu_speed="$2" ;; "--cpu_speed") cpu_speed="$2" ;;