Skip to content

Commit 08ecd31

Browse files
committed
fix: filter out tap entries from snapshot formulae
brew leaves includes tap formulae (e.g. "openbootdotdev/tap", "user/tap/formula") which are not installable packages. Filter them out by excluding entries containing "/".
1 parent d84df55 commit 08ecd31

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

internal/snapshot/capture.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,20 @@ func captureBrewList(args ...string) ([]string, error) {
295295
}
296296

297297
func CaptureFormulae() ([]string, error) {
298-
return captureBrewList("leaves")
298+
all, err := captureBrewList("leaves")
299+
if err != nil {
300+
return nil, err
301+
}
302+
303+
// Filter out tap formulae (e.g. "openbootdotdev/tap", "user/tap/formula")
304+
// which brew leaves includes but are not standalone packages.
305+
var formulae []string
306+
for _, f := range all {
307+
if !strings.Contains(f, "/") {
308+
formulae = append(formulae, f)
309+
}
310+
}
311+
return formulae, nil
299312
}
300313

301314
func CaptureCasks() ([]string, error) {

0 commit comments

Comments
 (0)