blob: e7d977aea13c140f477630b02345c21a58a8c197 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package exc
import (
"git.ewy.one/pik.git/describe"
"git.ewy.one/pik.git/model"
"git.ewy.one/pik.git/runner"
"git.ewy.one/pik.git/spool"
"os/exec"
)
type Executable struct {
runner.BaseTarget
Path string
}
type Hydrated struct {
*runner.BaseHydration[*Executable]
}
func (h *Hydrated) Icon() string {
return "\uEAE8"
}
func (h *Hydrated) Description(src *model.HydratedSource) string {
d, err := describe.Describe(h.Self, h.Self.Path)
if err != nil {
spool.Warn("%v\n", err)
}
return d
}
func (e *Executable) Create(s *model.Source) *exec.Cmd {
return exec.Command(e.Path)
}
func (e *Executable) Label() string {
return e.Identity.Full
}
func (e *Executable) Hydrate(src *model.Source) (model.HydratedTarget, error) {
return &Hydrated{
BaseHydration: &runner.BaseHydration[*Executable]{
Self: e,
},
}, nil
}
func (e *Executable) File(src *model.Source) string {
return e.Path
}
|