Merge pull request #257 from OpenSauce04/package_minimal

neowofetch: Add `--package_minimal` option
This commit is contained in:
Azalea 2024-05-01 17:33:30 -04:00 committed by GitHub
commit e466389ae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -235,6 +235,15 @@ package_managers="on"
# off: '17 packages (flatpak)' # off: '17 packages (flatpak)'
package_separate="on" package_separate="on"
# Reduce output of packages list by not showing programming language package managers or Steam games
#
# Flag: --package_minimal
#
# Example:
# default: 'Packages: 1 (npm), 991 (emerge), 3 (steam), 23 (flatpak-system)'
# minimal: 'Packages: 991 (emerge), 23 (flatpak-system)'
package_minimal=""
# Shell # Shell
@ -2066,10 +2075,10 @@ get_packages() {
} }
} }
# OS-independent package managers. # Programming language package managers.
if [[ -z "$package_minimal" ]]; then
has pipx && tot pipx list --short has pipx && tot pipx list --short
has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs" has cargo && _cargopkgs="$(cargo install --list | grep -v '^ ')" && tot echo "$_cargopkgs"
has am && pac "$(am -f --less)"
# Special case for npm: If has npm, we should list folders under node_modules instead of using npm list. # Special case for npm: If has npm, we should list folders under node_modules instead of using npm list.
# This is because npm list is very slow (2s) # This is because npm list is very slow (2s)
@ -2090,6 +2099,7 @@ get_packages() {
# as a package manager for this subsystem, so let's ignore this case. # as a package manager for this subsystem, so let's ignore this case.
fi fi
fi fi
fi
# OS-specific package managers. # OS-specific package managers.
case $os in case $os in
@ -2121,6 +2131,7 @@ get_packages() {
has squirrel && tot ls /var/packages has squirrel && tot ls /var/packages
has pkgx && tot find "$HOME/.pkgx" -maxdepth 2 -mindepth 2 -type d has pkgx && tot find "$HOME/.pkgx" -maxdepth 2 -mindepth 2 -type d
has anise && tot anise s --installed has anise && tot anise s --installed
has am && pac "$(am -f --less)"
# Using the dnf package cache is much faster than rpm. # Using the dnf package cache is much faster than rpm.
if has dnf && type -p sqlite3 >/dev/null && [[ -f /var/cache/dnf/packages.db ]]; then if has dnf && type -p sqlite3 >/dev/null && [[ -f /var/cache/dnf/packages.db ]]; then
@ -2155,6 +2166,7 @@ get_packages() {
shopt -u nullglob shopt -u nullglob
} }
if [[ -z "$package_minimal" ]]; then
# Steam games # Steam games
STEAM_P=".local/share/Steam/steamapps/common" STEAM_P=".local/share/Steam/steamapps/common"
if [[ -d "$HOME/$STEAM_P" ]]; then if [[ -d "$HOME/$STEAM_P" ]]; then
@ -2164,6 +2176,7 @@ get_packages() {
elif [[ -d "$HOME/.steam/steam/steamapps/common" ]]; then elif [[ -d "$HOME/.steam/steam/steamapps/common" ]]; then
manager=steam && dir "$HOME/.steam/steam/steamapps/common/*/" manager=steam && dir "$HOME/.steam/steam/steamapps/common/*/"
fi fi
fi
# 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$)))
@ -6368,6 +6381,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 --package_separate on/off Whether to separate system/user modes for supported package managers
--package_minimal Reduce output of packages list by not showing programming language package managers or Steam games
--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,
@ -6637,6 +6651,7 @@ get_args() {
"--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" ;; "--package_separate") package_separate="$2" ;;
"--package_minimal") package_minimal="1" ;;
"--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" ;;