Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is a list of distro.Distro factories.
func New ¶
func New(factories ...FactoryFunc) *Factory
New returns a Factory of distro.Distro factories for the given distros.
func NewDefault ¶
func NewDefault() *Factory
NewDefault returns a Factory of distro.Distro factories for all supported distros.
func NewTestDefault ¶
func NewTestDefault() *Factory
NewTestDefault returns a Factory of distro.Distro factory for the test_distro.
func (*Factory) FromHost ¶
FromHost returns a distro.Distro instance, that is specific to the host. If the host distro is not supported, nil is returned.
func (*Factory) GetDistro ¶
GetDistro returns the distro.Distro that matches the given distro ID. If no distro.Distro matches the given distro ID, it tries to translate the given distro ID using the aliases map and tries again. If no distro.Distro matches the given distro ID, it returns nil. If multiple distro factories match the given distro ID, it panics.
func (*Factory) RegisterAliases ¶
RegisterAliases configures the factory with aliases for distro names. The provided aliases map has the following constraints: - An alias must not mask an existing distro. - An alias target must map to an existing distro.
type FactoryFunc ¶
FactoryFunc is a function that returns a distro.Distro for a given distro represented as a string. If the string does not represent a distro, that can be detected by the factory, it should return nil.