more readable nixpkgs count check

This commit is contained in:
nekohepott 2026-06-17 04:16:25 +03:00
parent c712e8d295
commit de47ae56ff
No known key found for this signature in database

10
main.go
View File

@ -167,19 +167,17 @@ func getPkgs() string {
haveNix := checkNix() haveNix := checkNix()
if strings.HasPrefix(dist, "Arch") { if strings.HasPrefix(dist, "Arch") {
out, _ := exec.Command("sh", "-c", "pacman -Qq | wc -l").Output() out, _ := exec.Command("sh", "-c", "pacman -Qq | wc -l").Output()
pkgs = strings.TrimSpace(string(out)) + " (pacman)"
if haveNix { if haveNix {
pkgs = strings.TrimSpace(string(out)) + " (pacman), " + addNix() pkgs = strings.TrimSpace(string(pkgs + ", " + addNix()))
} else {
pkgs = strings.TrimSpace(string(out)) + " (pacman)"
} }
return pkgs return pkgs
} }
if strings.HasPrefix(dist, "Debian") { if strings.HasPrefix(dist, "Debian") {
out, _ := exec.Command("sh", "-c", "dpkg -l | grep ^ii | wc -l").Output() out, _ := exec.Command("sh", "-c", "dpkg -l | grep ^ii | wc -l").Output()
pkgs = strings.TrimSpace(string(out)) + " (apt)"
if haveNix { if haveNix {
pkgs = strings.TrimSpace(string(out)) + " (apt), " + addNix() pkgs = strings.TrimSpace(string(pkgs + ", " + addNix()))
} else {
pkgs = strings.TrimSpace(string(out)) + " (apt)"
} }
return pkgs return pkgs
} }