packages: Added option to display package counts individually.

This commit is contained in:
Dylan Araps 2018-06-04 14:40:18 +10:00
parent d6505023a9
commit 81beb26972

View file

@ -148,14 +148,15 @@ uptime_shorthand="on"
# Show/Hide Package Manager names. # Show/Hide Package Manager names.
# #
# Default: 'on' # Default: 'tiny'
# Values: 'on', 'off' # Values: 'on', 'tiny' 'off'
# Flag: --package_managers # Flag: --package_managers
# #
# Example: # Example:
# on: '900 (pacman, apt)' # on: '998 (pacman), 8 (flatpak), 4 (snap)'
# off: '900' # tiny: '908 (pacman, flatpak, snap)'
package_managers="on" # off: '908'
package_managers="tiny"
# Shell # Shell
@ -1248,7 +1249,7 @@ get_packages() {
# tot: Count lines in command output. # tot: Count lines in command output.
has() { type -p "$1" >/dev/null && manager="$_"; } has() { type -p "$1" >/dev/null && manager="$_"; }
dir() { ((packages+=$#)); pac "$#"; } dir() { ((packages+=$#)); pac "$#"; }
pac() { (($1 > 0)) && managers+="${manager}, "; } pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; }
tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; } tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; }
case "$os" in case "$os" in
@ -1333,11 +1334,16 @@ get_packages() {
if ((packages == 0)); then if ((packages == 0)); then
unset packages unset packages
elif [[ "$package_managers" == "on" && "${managers//,}" ]]; then elif [[ "$package_managers" == "on" ]]; then
managers="${managers/pacman-key/pacman}" printf -v packages '%s, ' "${managers[@]}"
managers="${managers/nix-env/nix}" packages="${packages%,*}"
packages+=" (${managers%,*})"
elif [[ "$package_managers" == "tiny" ]]; then
packages+=" (${manager_string%,*})"
fi fi
packages="${packages/pacman-key/pacman}"
packages="${packages/nix-env/nix}"
} }
get_shell() { get_shell() {
@ -4210,7 +4216,7 @@ INFO:
NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu' NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu'
--package_managers on/off Hide/Show Package Manager names. --package_managers on/off Hide/Show Package Manager names . (tiny, on, off)
--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,