@cryptotaxi247 / kubo / commits / 308ee5c94

commands: Added Request#SetOption so we can set options with multiple names

Matt Bell committed Oct 10, 2014 at 13:49 UTC 308ee5c9495bbb1afa1affe1c700f7d9d53e7d29
1 file changed +8
commands/request.go
+8
@@ -10,6 +10,14 @@ func (r *Request) Option(name string) interface{} {
10 return r.options[name]
11 }
12
13 +func (r *Request) SetOption(option Option, value interface{}) {
14 + // saves the option value in the map, indexed by each name
15 + // (so commands can retrieve it using any of the names)
16 + for _, name := range option.Names {
17 + r.options[name] = value
18 + }
19 +}
20 +
21 func (r *Request) Arguments() []string {
22 return r.arguments
23 }