feat: implement list of available distros
This commit is contained in:
@@ -9,6 +9,7 @@ var distros []distribution
|
||||
|
||||
type distribution interface {
|
||||
ID() ID
|
||||
Release() string
|
||||
Equal(Distro) bool
|
||||
Packages() (packages []string, err error)
|
||||
}
|
||||
@@ -20,6 +21,20 @@ func Register(d distribution) {
|
||||
distros = append(distros, d)
|
||||
}
|
||||
|
||||
func List() (dds []Distro) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
for _, dd := range distros {
|
||||
dds = append(dds, Distro{
|
||||
ID: dd.ID(),
|
||||
Release: dd.Release(),
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
type Distro struct {
|
||||
ID ID
|
||||
Release string
|
||||
|
||||
Reference in New Issue
Block a user