diff --git a/bonzai.go b/bonzai.go index 7a58458..d6b8fa3 100644 --- a/bonzai.go +++ b/bonzai.go @@ -15,7 +15,7 @@ import ( // args expected and "none" if not. Methods must never write error // output to anything but standard error and should almost always use // the log package to do so. -type Method func(args ...string) error +type Method func(caller *Cmd, args ...string) error // ----------------------- errors, exit, debug ----------------------- diff --git a/cmd.go b/cmd.go index 9b89b52..73250f1 100644 --- a/cmd.go +++ b/cmd.go @@ -95,7 +95,7 @@ func (x *Cmd) Run() { if def.Call == nil { ExitError("default command \"%v\" must be callable", def.Name) } - if err := def.Call(args...); err != nil { + if err := def.Call(x, args...); err != nil { ExitError(err) } Exit() @@ -104,7 +104,7 @@ func (x *Cmd) Run() { } // delegate - if err := cmd.Call(args...); err != nil { + if err := cmd.Call(x, args...); err != nil { ExitError(err) } Exit()