-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
think deeply about package layout #96
Comments
amonks
added
enhancement
New feature or request
needs thought
We have some decisions to make before moving on this.
labels
Mar 30, 2024
this feels pretty good to me: // package tasks
type Task interface {
Metadata() TaskMetadata
Start(context.Context, io.Writer) (<-chan struct{}, error) // chan is `ready`
}
type TaskMetadata struct{}
type Tasks struct{}
func (Tasks) Validate() error
func (Tasks) IDs() []string
func (Tasks) Task(id string) Task
func (Tasks) Watches() []string
func (Tasks) Subtree(id string) Tasks
// list of ids where metadata matches the argument
func (Tasks) WithWatch(watch string) []string
func (Tasks) WithDependency(dependency string) []string
func (Tasks) WithTrigger(trigger string) []string // package script
type Script struct{}
func New(cwd, script string) Script
func (Script) Start(context.Context, io.Writer) error
type ScriptTask struct {
script Script
metadata TaskMetadata
}
var _ Task = ScriptTask{}
func NewScriptTask(Script, TaskMetadata)
func (ScriptTask) CWD() string // so that Tasks.Validate() can check for ../ watches
func (ScriptTask) Metadata() TaskMetadata
func (ScriptTask) Start(context.Context, io.Writer) (<-chan struct{}, error) // package taskfile
type Taskfile struct{}
func Load(string) (Taskfile, error)
func (Taskfile) Validate() error
func (Taskfile) Tasks() Tasks // package runner
type Runner struct{}
func New(tasks []Task) Runner
func (Runner) Start(context.Context, MultiWriter, entryPointTaskIDs ...string) error
func (Runner) Add(id string) error // add more entry-point tasks mid-run
func (Runner) Remove(id string) error // remove entry-point tasks mid-run
func (Runner) Invalidate(id string) error
func (Runner) Status() map[string]TaskStatus
type MultiWriter interface {
Writer(id string) io.Writer
}
type TaskStatus int // package tui
func Start(ctx context.Context, tasks Tasks, entryPointTaskIDs ...string) error // package printer
type Printer struct{}
var _ MultiWriter = Printer{}
func NewPrinter(gutterWidth int) Printer
func (Printer) Writer(string) io.Writer |
amonks
removed
the
needs thought
We have some decisions to make before moving on this.
label
Apr 6, 2024
Draft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't want to change this ever after 1.0, so I'd like to make sure it's right before releasing that version.
Some considerations:
internal
? should the tui?scroll
live? their own repo? should logview?The text was updated successfully, but these errors were encountered: