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:
Alec Thomas
2018-09-27 14:20:16 +10:00
parent 5d7703774f
commit f72f53d947
5 changed files with 54 additions and 29 deletions
+6
View File
@@ -23,6 +23,12 @@ func (b bindings) clone() bindings {
return out
}
func (b bindings) merge(other bindings) {
for k, v := range other {
b[k] = v
}
}
func getMethod(value reflect.Value, name string) reflect.Value {
method := value.MethodByName(name)
if !method.IsValid() {