mirror of
https://github.com/Cheviiot/Vintner.git
synced 2026-08-03 15:57:24 +00:00
- download --list-workloads / --list-components print every workload or component id (with its manifest title) without downloading anything, for discovering what to pass as a package id or --with-* toggle. - download --print-deps-tree prints the dependency tree of whatever the current flags would actually select, sharing the exact same arch/--ignore/Optional/Recommended filtering ExpandSelection uses so the output matches a real download; diamond dependencies are shown once and referenced as "(see above)" afterwards to keep it finite. - Fixed --manifest (offline/predownloaded manifest testing) never having worked at all: it builds a "file:" URL but the shared http.Client had no handler registered for that scheme. - Added a CI workflow running gofmt/vet/build/test on every push and PR; previously only the tag-triggered release workflow existed.
19 lines
468 B
Go
19 lines
468 B
Go
package download
|
|
|
|
import "sort"
|
|
|
|
// PackagesByType returns the best (arch/language-matching) variant of every
|
|
// package in idx whose Type equals kind (e.g. "Workload" or "Component"),
|
|
// sorted by ID.
|
|
func PackagesByType(idx Index, kind string) []*Package {
|
|
var ret []*Package
|
|
for _, variants := range idx {
|
|
p := variants[0]
|
|
if p.Type == kind {
|
|
ret = append(ret, p)
|
|
}
|
|
}
|
|
sort.Slice(ret, func(i, j int) bool { return ret[i].ID < ret[j].ID })
|
|
return ret
|
|
}
|