feat: some basic commands
This commit is contained in:
@@ -2,6 +2,8 @@ package registry
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"iter"
|
||||
"maps"
|
||||
|
||||
"git.maximhutz.com/max/lambda/internal/cli"
|
||||
)
|
||||
@@ -63,7 +65,7 @@ func (r *Registry) MustAddEngine(e cli.Engine) {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Registry) GetEngine(name string) (cli.Engine, error) {
|
||||
func (r Registry) GetEngine(name string) (cli.Engine, error) {
|
||||
e, ok := r.engines[name]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("engine '%s' not found", name)
|
||||
@@ -72,6 +74,10 @@ func (r *Registry) GetEngine(name string) (cli.Engine, error) {
|
||||
return e, nil
|
||||
}
|
||||
|
||||
func (r Registry) ListEngines() iter.Seq[cli.Engine] {
|
||||
return maps.Values(r.engines)
|
||||
}
|
||||
|
||||
func (r *Registry) GetDefaultEngine(id string) (cli.Engine, error) {
|
||||
for _, engine := range r.engines {
|
||||
if engine.InType() == id {
|
||||
|
||||
Reference in New Issue
Block a user