diff --git a/commands/request.go b/commands/request.go index ee3747442..8cceebc46 100644 --- a/commands/request.go +++ b/commands/request.go @@ -77,6 +77,7 @@ type Request interface { Context() *Context SetContext(Context) Command() *Command + Values() map[string]interface{} ConvertOptions() error } @@ -89,6 +90,7 @@ type request struct { cmd *Command ctx Context optionDefs map[string]Option + values map[string]interface{} } // Path returns the command path of this request @@ -208,6 +210,10 @@ var converters = map[reflect.Kind]converter{ }, } +func (r *request) Values() map[string]interface{} { + return r.values +} + func (r *request) ConvertOptions() error { for k, v := range r.options { opt, ok := r.optionDefs[k] @@ -275,7 +281,8 @@ func NewRequest(path []string, opts optMap, args []string, file files.File, cmd } ctx := Context{Context: context.TODO()} - req := &request{path, opts, args, file, cmd, ctx, optDefs} + values := make(map[string]interface{}) + req := &request{path, opts, args, file, cmd, ctx, optDefs, values} err := req.ConvertOptions() if err != nil { return nil, err