commands: Added Request#Options so consumers can iterate through provided options
Matt Bell committed
Oct 23, 2014 at 16:30 UTC
a65c99e71e380ab881d02dcc07894c65420dba86
1 file changed
+10
commands/request.go
+10
@@ -13,6 +13,7 @@ type optMap map[string]interface{}
13
type Request interface {
14
Path() []string
15
Option(name string) (interface{}, bool)
16
+ Options() map[string]interface{}
17
SetOption(name string, val interface{})
18
Arguments() []string
19
Stream() io.Reader
@@ -39,6 +40,15 @@ func (r *request) Option(name string) (interface{}, bool) {
40
return val, err
41
}
42
43
+// Options returns a copy of the option map
44
+func (r *request) Options() map[string]interface{} {
45
+ output := make(optMap)
46
+ for k, v := range r.options {
47
+ output[k] = v
48
+ }
49
+ return output
50
+}
51
+
52
// SetOption sets the value of the option for given name.
53
func (r *request) SetOption(name string, val interface{}) {
54
r.options[name] = val