Macchina-CLI/macchina

[BUG] Brew packages are displayed +1

Markos-Th09 opened this issue · 7 comments

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.

  • Distribution: none
  • Desktop Environment: Aqua (not an option but whatever)
  • Operating System: macOS
  • Terminal: macOS terminal
  • Macchina's version: 6.1.5

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

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

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

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

This is an easy fix :)

I'll also subtract the result by one.

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

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

Moving this to libmacchina