chore: remove code duplication

This commit is contained in:
Maxim Slipenko 2025-01-31 17:05:14 +03:00
parent 0d1db212e1
commit 55feea9b25
2 changed files with 3 additions and 17 deletions

@ -11,7 +11,7 @@
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="33.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
<text x="33.5" y="14">coverage</text>
<text x="86" y="15" fill="#010101" fill-opacity=".3">18.2%</text>
<text x="86" y="14">18.2%</text>
<text x="86" y="15" fill="#010101" fill-opacity=".3">18.3%</text>
<text x="86" y="14">18.3%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 926 B

After

Width:  |  Height:  |  Size: 926 B

@ -169,21 +169,7 @@ type ScriptFunc func(ctx context.Context, opts ...interp.RunnerOption) error
// GetFunc returns a function corresponding to a bash function
// with the given name
func (d *Decoder) GetFunc(name string) (ScriptFunc, bool) {
fn := d.getFunc(name)
if fn == nil {
return nil, false
}
return func(ctx context.Context, opts ...interp.RunnerOption) error {
sub := d.Runner.Subshell()
for _, opt := range opts {
err := opt(sub)
if err != nil {
return err
}
}
return sub.Run(ctx, fn)
}, true
return d.GetFuncP(name, nil)
}
type PrepareFunc func(context.Context, *interp.Runner) error