Skip to content

Commit

Permalink
Add missing string setter
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuss committed Nov 17, 2024
1 parent 735d75e commit d7d1027
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions provider/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,21 @@ func (p *Script) BoolSetter(param string) (func(bool) error, error) {
return err
}, nil
}

var _ SetStringProvider = (*Script)(nil)

// StringSetter returns a function that invokes a script with parameter by a string value
func (p *Script) StringSetter(param string) (func(string) error, error) {

Check failure on line 168 in provider/script.go

View workflow job for this annotation

GitHub Actions / Lint

unnecessary leading newline (whitespace)

return func(v string) error {
cmd, err := util.ReplaceFormatted(p.script, map[string]interface{}{
param: v,
})

if err == nil {
_, err = p.exec(cmd)
}

return err
}, nil
}

0 comments on commit d7d1027

Please sign in to comment.