Files
LazyPM/pkg/task/types.go
Robin Olsen 23747fb799 refactor to use Tasker interface instead of Task
add tasker register for registering tasks for extiensibility
2026-02-18 13:07:23 +01:00

41 lines
771 B
Go

package task
import (
"context"
"github.com/LazyBachelor/LazyPM/internal/service"
taskui "github.com/LazyBachelor/LazyPM/pkg/task/ui"
)
type TaskConfig = service.Config
type Interface interface {
Run(context.Context, TaskConfig) error
}
type InterfaceType string
const (
InterfaceTUI InterfaceType = "tui"
InterfaceCLI InterfaceType = "repl"
InterfaceWeb InterfaceType = "web"
)
type Tasker interface {
Config() TaskConfig
Details() taskui.TaskDetails
Questions(InterfaceType) taskui.Questions
Setup(context.Context) error
Validate(context.Context) (bool, error)
}
type ValidationFeedback struct {
Success bool
Message string
}
type ValidatedInterface interface {
Interface
SetChannels(feedbackChan chan ValidationFeedback, quitChan chan bool)
}