Skip to content

refactor: flatten package managers into plain functions - #6

Merged
DeityLamb merged 2 commits into
mainfrom
claude/epic-newton-xtontj
Oct 7, 2026
Merged

DeityLamb merged 2 commits into
mainfrom
claude/epic-newton-xtontj

Conversation

@DeityLamb

@DeityLamb DeityLamb commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Replace the PackageManager trait and structs with src/packages/: one count() function per manager (xbps, apk, pacman, emerge) and packages::get() in mod.rs.
  • Detect every available package manager instead of choosing one by /etc/os-release. One manager prints just the count (632); several print xbps(632), apk(251).
  • Print Unknown instead of panicking when no supported manager is found (and when xbps has no pkgdb-* file).
  • Fix pacman count: it kept only all-lowercase entry names, so real entries like bash-5.2.026-2 were skipped. It now counts package directories, which excludes only the ALPM_DB_VERSION file.
  • Remove the "supports the following package managers" section from the README, since it read like a list of install targets.

Testing

  • cargo fmt --check and cargo clippy --all-targets -- -D warnings pass.
  • On Ubuntu: pkgs Unknown. With fake apk + emerge databases: apk(2), emerge(1); with apk only: 2.
  • Fake pacman db with 3 package dirs + ALPM_DB_VERSION: 3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tcei1A4L5TW8AskmMbjWFQ

claude added 2 commits October 7, 2026 17:04
- Replace the PackageManager trait/structs with src/packages/,
  one count() function per manager
- Show every detected package manager instead of picking one by
  distro: a single one prints just the count, several print
  "xbps(632), apk(251)"
- Print "Unknown" instead of panicking when none is found
- Drop the package manager list from README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tcei1A4L5TW8AskmMbjWFQ
Package entries are named like bash-5.2.026-2, so the all-lowercase
filter skipped almost all of them. Count directories instead, which
leaves out only the ALPM_DB_VERSION file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tcei1A4L5TW8AskmMbjWFQ
@DeityLamb
DeityLamb merged commit 90b67d9 into main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants