-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtask.go
More file actions
24 lines (19 loc) · 691 Bytes
/
Copy pathtask.go
File metadata and controls
24 lines (19 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package agentfleet
import "strings"
// Task is the minimum contract for any runnable unit.
type Task interface {
ID() string
Name() string
Command() string
}
// BasicTask is the default Task implementation.
type BasicTask struct {
TaskID string `json:"id" yaml:"id"`
TaskName string `json:"name" yaml:"name"`
Cmd string `json:"command" yaml:"command"`
}
func (t *BasicTask) ID() string { return t.TaskID }
func (t *BasicTask) Name() string { return t.TaskName }
func (t *BasicTask) Command() string { return t.Cmd }
// CommandFields splits Task.Command() into argv for NewPtyAgent.
func CommandFields(t Task) []string { return strings.Fields(t.Command()) }