use registry for interfaces also

add list interfaces command
This commit is contained in:
Robin Olsen
2026-02-22 22:58:04 +01:00
parent 78769396e7
commit 235b07f7ce
5 changed files with 76 additions and 29 deletions

View File

@@ -5,10 +5,7 @@ import (
"github.com/LazyBachelor/LazyPM/cmd/survey/tasks"
"github.com/LazyBachelor/LazyPM/internal/service"
"github.com/LazyBachelor/LazyPM/pkg/repl"
"github.com/LazyBachelor/LazyPM/pkg/task"
"github.com/LazyBachelor/LazyPM/pkg/tui"
"github.com/LazyBachelor/LazyPM/pkg/web"
_ "github.com/LazyBachelor/LazyPM/cmd/survey/tasks"
)
@@ -18,18 +15,21 @@ func initializeServices(ctx context.Context) (*service.App, func(), error) {
}
func initInterfaces() map[string]task.Interface {
return map[string]task.Interface{
"repl": repl.NewRepl(),
"tui": tui.NewTui(),
"web": web.NewWeb(),
interfaces := make(map[string]task.Interface)
for _, name := range task.ListInterfaces() {
i, err := task.GetInterface(name)
if err != nil {
continue
}
interfaces[name] = i
}
return interfaces
}
func initTasks(app *service.App) []task.Tasker {
var taskList []task.Tasker
for _, name := range task.List() {
t, err := task.Get(name, app)
for _, name := range task.ListTasks() {
t, err := task.GetTasks(name, app)
if err != nil {
continue
}