diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-29 01:30:12 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-29 01:30:12 +0200 |
| commit | 2b28ee919614d5ddaceda26ce488a0ca4c851cb3 (patch) | |
| tree | df9a9af3f6b37165c9522eefea8456aa1baea9d5 /runner/just | |
| parent | 19f68366eb4a2c01f801b29585fd0a36bdf47488 (diff) | |
simplify the contracts
Diffstat (limited to 'runner/just')
| -rw-r--r-- | runner/just/just.go | 9 | ||||
| -rw-r--r-- | runner/just/target.go | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/runner/just/just.go b/runner/just/just.go index 7d6bb92..377553e 100644 --- a/runner/just/just.go +++ b/runner/just/just.go @@ -4,6 +4,7 @@ import ( "errors" "io/fs" "os/exec" + "path/filepath" "pik/identity" "pik/model" "pik/runner" @@ -11,10 +12,13 @@ import ( ) type just struct { - path string + path string + files map[string]string } -var Indexer = &just{} +var Indexer = &just{ + files: make(map[string]string), +} func (j *just) Index(path string, f fs.FS, runners []model.Runner) ([]model.Target, error) { @@ -25,6 +29,7 @@ func (j *just) Index(path string, f fs.FS, runners []model.Runner) ([]model.Targ hasJustfile := false for _, e := range entries { if !e.IsDir() && strings.ToLower(e.Name()) == "justfile" { + j.files[path] = filepath.Join(path, e.Name()) hasJustfile = true break } diff --git a/runner/just/target.go b/runner/just/target.go index ca33b6b..9319e73 100644 --- a/runner/just/target.go +++ b/runner/just/target.go @@ -11,6 +11,10 @@ type Target struct { Category string } +func (j Target) File(src *model.Source) string { + return Indexer.files[src.Path] +} + func (j Target) Create(s *model.Source) *exec.Cmd { return exec.Command(Indexer.path, j.Identity.Full) } @@ -36,6 +40,10 @@ type Hydrated struct { runner.BaseHydration[*Target] } +func (h *Hydrated) Description(src *model.HydratedSource) string { + return "" +} + func (h *Hydrated) Icon() string { return "\uF039" } |
