-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Follow up from #37 (comment)
The metadata or descriptions are not too relevant for the actual execution.
For pre-defined tasks (like SSHClose
) I propose we provide a default description (the user can change it). The user can also create its own tasks:
type SSHOpen struct {
description string
}
type SSHClose struct {
description string
}
type MyTask struct {
description string
}
func NewSSHOpen() SSHOpen {
return SSHOpen{
description: "Open SSH connection",
}
}
func NewSSHClose() SSHClose {
return SSHClose{
description: "Close SSH connection",
}
}
The goal is the user program at very high level looks something like (MyTask
in the same connection
package for simplicity in this example):
func main() {
...
sshOpen := connection.NewSSHOpen()
sshClose := connection.NewSSHClose()
myTask := connection.MyTask{description: "Something else"}
gr.RunSync(sshOpen)
defer gr.RunSync(sshClose)
gr.RunSync(myTask)
fmt.Println("Doing this:", sshOpen.description, myTask.description, sshClose.description)
...
}
The user creates tasks that are then executed in single lines.