blob: 7a6ce81344d0d657425b7cf14539630fb15f0d51 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package runner
import (
"os/exec"
"pik/identity"
"pik/model"
)
type BaseTarget struct {
identity.Identity
MyTags model.Tags
}
func (t *BaseTarget) Tags() model.Tags {
return t.MyTags
}
func (t *BaseTarget) Matches(input string) bool {
return t.Identity.Is(input)
}
func (t *BaseTarget) ShortestId() string {
return t.Reduced
}
func Hydrated[T model.Target](in T) BaseHydration[T] {
return BaseHydration[T]{
BaseTarget: in,
}
}
type BaseHydration[T model.Target] struct {
BaseTarget T
}
func (b BaseHydration[T]) Matches(input string) bool {
return b.BaseTarget.Matches(input)
}
func (b BaseHydration[T]) Create(s *model.Source) *exec.Cmd {
return b.BaseTarget.Create(s)
}
func (b BaseHydration[T]) Sub() []string {
return b.BaseTarget.Sub()
}
func (b BaseHydration[T]) Label() string {
return b.BaseTarget.Label()
}
func (b BaseHydration[T]) Hydrate(src *model.Source) (model.HydratedTarget, error) {
return b, nil
}
func (b BaseHydration[T]) Visible() bool {
return b.BaseTarget.Visible()
}
func (b BaseHydration[T]) Tags() model.Tags {
return b.BaseTarget.Tags()
}
func (b BaseHydration[T]) ShortestId() string {
return b.BaseTarget.ShortestId()
}
func (b BaseHydration[T]) Icon() string {
return " "
}
func (b BaseHydration[T]) Description() string {
return "//TODO"
}
func (b BaseHydration[T]) Target() model.Target {
return b.BaseTarget
}
func (b BaseTarget) Visible() bool {
return b.Tags().Visible()
}
|