summaryrefslogtreecommitdiff
path: root/runner/shell/hydrated.go
blob: 5aefab85dba34a04833e8ffc9723e5c7bda5f461 (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
package shell

import (
	"git.sr.ht/~ewy/pik/describe"
	"git.sr.ht/~ewy/pik/model"
	"git.sr.ht/~ewy/pik/runner"
	"git.sr.ht/~ewy/pik/spool"
)

type Hydrated struct {
	runner.BaseHydration[*Target]
}

func (h *Hydrated) Icon() string {
	return "\uF489"
}

func (h *Hydrated) Description(src *model.HydratedSource) string {
	desc, err := describe.Describe(h.Target(), h.Target().File(src.Source))
	if err != nil {
		_, _ = spool.Warn("%v\n", err)
		return ""
	}
	return desc
}