Add --package_minimal
Reduces 'packages' output by omitting language package managers and Steam games, improving execution speed
This commit is contained in:
parent
51f0ebf3ea
commit
3a415600d5
1 changed files with 43 additions and 28 deletions
19
neofetch
19
neofetch
|
@ -235,6 +235,15 @@ package_managers="on"
|
|||
# off: '17 packages (flatpak)'
|
||||
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
|
||||
|
||||
|
@ -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 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.
|
||||
# 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.
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# OS-specific package managers.
|
||||
case $os in
|
||||
|
@ -2121,6 +2131,7 @@ get_packages() {
|
|||
has squirrel && tot ls /var/packages
|
||||
has pkgx && tot find "$HOME/.pkgx" -maxdepth 2 -mindepth 2 -type d
|
||||
has anise && tot anise s --installed
|
||||
has am && pac "$(am -f --less)"
|
||||
|
||||
# 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
|
||||
|
@ -2155,6 +2166,7 @@ get_packages() {
|
|||
shopt -u nullglob
|
||||
}
|
||||
|
||||
if [[ -z "$package_minimal" ]]; then
|
||||
# Steam games
|
||||
STEAM_P=".local/share/Steam/steamapps/common"
|
||||
if [[ -d "$HOME/$STEAM_P" ]]; then
|
||||
|
@ -2164,6 +2176,7 @@ get_packages() {
|
|||
elif [[ -d "$HOME/.steam/steam/steamapps/common" ]]; then
|
||||
manager=steam && dir "$HOME/.steam/steam/steamapps/common/*/"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Other (Needs complex command)
|
||||
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.
|
||||
--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_minimal Reduce output of packages list by not showing programming language package managers or Steam games
|
||||
--os_arch on/off Hide/Show OS architecture.
|
||||
--speed_type type Change the type of cpu speed to display.
|
||||
Possible values: current, min, max, bios,
|
||||
|
@ -6637,6 +6651,7 @@ get_args() {
|
|||
"--title_fqdn") title_fqdn="$2" ;;
|
||||
"--package_managers") package_managers="$2" ;;
|
||||
"--package_separate") package_separate="$2" ;;
|
||||
"--package_minimal") package_minimal="1" ;;
|
||||
"--os_arch") os_arch="$2" ;;
|
||||
"--cpu_cores") cpu_cores="$2" ;;
|
||||
"--cpu_speed") cpu_speed="$2" ;;
|
||||
|
|
Loading…
Reference in a new issue