diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-29 01:59:23 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-29 01:59:23 +0200 |
| commit | 28e43c7356d796e18d2f818d100078c5aa31c14c (patch) | |
| tree | 023c7f4a9d192bcf4f16755307f43a622beb671d /runner/exc/target.go | |
| parent | 2b28ee919614d5ddaceda26ce488a0ca4c851cb3 (diff) | |
add executable runner
Diffstat (limited to 'runner/exc/target.go')
| -rw-r--r-- | runner/exc/target.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/runner/exc/target.go b/runner/exc/target.go new file mode 100644 index 0000000..c9d20b8 --- /dev/null +++ b/runner/exc/target.go @@ -0,0 +1,50 @@ +package exc + +import ( + "os/exec" + "pik/describe" + "pik/model" + "pik/runner" + "pik/spool" +) + +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 +} |
