wip: add split packages support
This commit is contained in:
@ -197,6 +197,27 @@ func (d *Decoder) GetFuncP(name string, prepare PrepareFunc) (ScriptFunc, bool)
|
||||
}, true
|
||||
}
|
||||
|
||||
// TODO: replace
|
||||
func (d *Decoder) GetFuncSub(name string) (
|
||||
func(ctx context.Context, opts ...interp.RunnerOption) (*interp.Runner, error), bool,
|
||||
) {
|
||||
fn := d.getFunc(name)
|
||||
if fn == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
return func(ctx context.Context, opts ...interp.RunnerOption) (*interp.Runner, error) {
|
||||
sub := d.Runner.Subshell()
|
||||
for _, opt := range opts {
|
||||
err := opt(sub)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return sub, sub.Run(ctx, fn)
|
||||
}, true
|
||||
}
|
||||
|
||||
func (d *Decoder) getFunc(name string) *syntax.Stmt {
|
||||
names, err := overrides.Resolve(d.info, overrides.DefaultOpts.WithName(name))
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user