Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.49k stars 52 forks source link

[BUG] Brew packages are displayed +1 #266

Closed Markos-Th09 closed 2 years ago

Markos-Th09 commented 2 years ago

Describe the bug The total number of homebrew packages including casks, bottles and formulae is also displayed +1. For example if I have 4 packages, they are displayed as 5.

To Reproduce Steps to reproduce the behavior:

  1. Install macchina in macOS
  2. Install homebrew
  3. Install some homebrew packages
  4. Use the macchina program

Expected behavior The total amount of packages should display the actual count

Screenshots

Screenshot 2022-09-22 at 14 41 25

macchina --doctor output

Screenshot 2022-09-22 at 14 40 23

System Information You don't have to provide this information if you're not comfortable doing so, but it'll help us solve the issue a lot faster.

grtcdr commented 2 years ago

Can you show me the output of brew list | wc -l?

Markos-Th09 commented 2 years ago

Can you show me the output of brew list | wc -l? brew list|wc -l 4

~~Actually I used a different command which also shows bottles (dependencies) which I assumed it was also counting brew info --json=v1 --installed | jq -r "map(select(.installed[].poured_from_bottle) | .name) | unique | .[]"|wc -l.~~ Edit: actually piping brew list seems to do the same thing

Markos-Th09 commented 2 years ago

I just actually found the problem. There seems to also be a .keepme file along the packages (referring to this issue)

Screenshot 2022-09-22 at 18 08 25

This problem comes down to libmacchina

grtcdr commented 2 years ago

Hmm, I thought we ignored any ".keepme"s.

This is an easy fix :)

I'll also subtract the result by one.

Markos-Th09 commented 2 years ago

Ok although imo the more correct solution fix would be to also check if the .keepme is there first

Markos-Th09 commented 2 years ago

Also unrelated but I just noticed it isn't showing anything from cargo

Markos-Th09 commented 2 years ago

Moving this to libmacchina