summaryrefslogtreecommitdiff
path: root/runner/shell/target.go
blob: e823d412bf8b514fb0afaff247ebec0aff06c9b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package shell

import (
	"os/exec"
	"path/filepath"
	"pik/model"
	"pik/runner"
)

type ShellTarget struct {
	runner.BaseTarget
	Shell    string
	Script   string
	SubValue []string
}

func (s *ShellTarget) String() string {
	return s.Label()
}

func (s *ShellTarget) Hydrate(_ *model.Source) (model.HydratedTarget, error) {
	return Runner.Hydrate(s)
}

func (s *ShellTarget) Sub() []string {
	return s.SubValue
}

func (s *ShellTarget) Label() string {
	return s.Identity.Full
}

func (s *ShellTarget) Create(src *model.Source) *exec.Cmd {
	return exec.Command(s.Shell, filepath.Join(src.Path, s.Script))
}