Skip to content

Commit

Permalink
[F] Fix #305
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Oct 23, 2024
1 parent 49b26dc commit c68dd7f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -2397,15 +2397,25 @@ get_packages() {
;;
esac

# Count the total number of packages.
total_packages=0
for manager_info in "${managers[@]}"; do
count=$(echo "$manager_info" | awk '{print $1}')
total_packages=$((total_packages + count))
done

if ((packages == 0)); then
unset packages

elif [[ $package_managers == on ]]; then
# List individual package manager counts
printf -v packages '%s, ' "${managers[@]}"
packages=${packages%,*}

elif [[ $package_managers == tiny ]]; then
packages+=" (${manager_string%,*})"
# Show total count with package manager names
packages="$total_packages (${manager_string%,*})"
else
# Default to showing just the total count
packages="$total_packages"
fi

packages=${packages/pacman-key/pacman}
Expand Down

0 comments on commit c68dd7f

Please sign in to comment.