Support for adding bindings to the Context.
This is very useful for hooks to pre-construct objects that can be used by all subsequent downstream commands, for example.
This commit is contained in:
@@ -239,7 +239,10 @@ func (k *Kong) applyHook(ctx *Context, name string) error {
|
||||
if !method.IsValid() {
|
||||
continue
|
||||
}
|
||||
binds := k.bindings.clone().add(ctx, trace).add(trace.Node().Vars().CloneWith(k.vars))
|
||||
binds := k.bindings.clone()
|
||||
binds.add(ctx, trace)
|
||||
binds.add(trace.Node().Vars().CloneWith(k.vars))
|
||||
binds.merge(ctx.bindings)
|
||||
if err := callMethod(name, value, method, binds); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user