neofetch icon indicating copy to clipboard operation
neofetch copied to clipboard

dnf method alone doesn't show package output

Open PriamX opened this issue 1 year ago • 1 comments

In the master branch, line 1571:

pac "$(sqlite3 /var/cache/dnf/packages.db "SELECT count(pkg) FROM installed")"

...does not increment the packages variable, thus if dnf is the only package method packages will equal zero and the "Packages:" line is not displayed. Here's my very humble and mostly untested fix:

# 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
     dnfcnt="$(sqlite3 /var/cache/dnf/packages.db "SELECT count(pkg) FROM installed")"
     pac "${dnfcnt}"
     packages+=${dnfcnt}
else

PriamX avatar Sep 27 '23 18:09 PriamX

In the master branch, line 1571:

pac "$(sqlite3 /var/cache/dnf/packages.db "SELECT count(pkg) FROM installed")"

...does not increment the packages variable, thus if dnf is the only package method packages will equal zero and the "Packages:" line is not displayed.

I don't think this is true. Since has {manager} sets the manager variable and pac {count} appends the count with the manager to the finalized package count string, the original implementation should be correct. And it also runs correctly on my Fedora vps so it's correct.

image_2023-09-29_02-45-02

image

hykilpikonna avatar Sep 29 '23 06:09 hykilpikonna