From f6963b1c451afcb2f0d0104f38178235e52f8b63 Mon Sep 17 00:00:00 2001 From: ewy Date: Tue, 14 Apr 2026 20:13:13 +0200 Subject: remove all name repetition --- runner/shell/hydrated.go | 8 ++++---- runner/shell/shell.go | 6 +++--- runner/shell/target.go | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'runner/shell') diff --git a/runner/shell/hydrated.go b/runner/shell/hydrated.go index 77fc45c..e1f8892 100644 --- a/runner/shell/hydrated.go +++ b/runner/shell/hydrated.go @@ -6,15 +6,15 @@ import ( "pik/spool" ) -type HydratedShellTarget struct { - runner.BaseHydration[*ShellTarget] +type Hydrated struct { + runner.BaseHydration[*Target] } -func (h *HydratedShellTarget) Icon() string { +func (h *Hydrated) Icon() string { return "\uF489" } -func (h *HydratedShellTarget) Description() string { +func (h *Hydrated) Description() string { desc, err := describe.Describe(h.BaseTarget.Script) if err != nil { spool.Warn("%v\n", err) diff --git a/runner/shell/shell.go b/runner/shell/shell.go index 5333279..9d34e0f 100644 --- a/runner/shell/shell.go +++ b/runner/shell/shell.go @@ -38,11 +38,11 @@ type shell struct { var WrongTargetError = errors.New("wrong target type") func (s *shell) Hydrate(target model.Target) (model.HydratedTarget, error) { - cast, ok := target.(*ShellTarget) + cast, ok := target.(*Target) if !ok { return nil, WrongTargetError } - hyd := &HydratedShellTarget{BaseHydration: runner.Hydrated(cast)} + hyd := &Hydrated{BaseHydration: runner.Hydrated(cast)} return hyd, nil } @@ -102,7 +102,7 @@ func (s *shell) CreateTarget(fs fs.FS, src string, file string, _ fs.DirEntry) ( } sub = append(sub, p) } - return &ShellTarget{ + return &Target{ BaseTarget: runner.BaseTarget{ Identity: identity.New(filename), MyTags: model.TagsFromFilename(filename), diff --git a/runner/shell/target.go b/runner/shell/target.go index e823d41..db3fcc8 100644 --- a/runner/shell/target.go +++ b/runner/shell/target.go @@ -7,29 +7,29 @@ import ( "pik/runner" ) -type ShellTarget struct { +type Target struct { runner.BaseTarget Shell string Script string SubValue []string } -func (s *ShellTarget) String() string { +func (s *Target) String() string { return s.Label() } -func (s *ShellTarget) Hydrate(_ *model.Source) (model.HydratedTarget, error) { +func (s *Target) Hydrate(_ *model.Source) (model.HydratedTarget, error) { return Runner.Hydrate(s) } -func (s *ShellTarget) Sub() []string { +func (s *Target) Sub() []string { return s.SubValue } -func (s *ShellTarget) Label() string { +func (s *Target) Label() string { return s.Identity.Full } -func (s *ShellTarget) Create(src *model.Source) *exec.Cmd { +func (s *Target) Create(src *model.Source) *exec.Cmd { return exec.Command(s.Shell, filepath.Join(src.Path, s.Script)) } -- cgit v1.3