From 308ee5c9495bbb1afa1affe1c700f7d9d53e7d29 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Fri, 10 Oct 2014 13:49:12 -0700 Subject: [PATCH] commands: Added Request#SetOption so we can set options with multiple names --- commands/request.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/commands/request.go b/commands/request.go index 824d48d71..7373a1a24 100644 --- a/commands/request.go +++ b/commands/request.go @@ -10,6 +10,14 @@ func (r *Request) Option(name string) interface{} { return r.options[name] } +func (r *Request) SetOption(option Option, value interface{}) { + // saves the option value in the map, indexed by each name + // (so commands can retrieve it using any of the names) + for _, name := range option.Names { + r.options[name] = value + } +} + func (r *Request) Arguments() []string { return r.arguments }