Commit 2d3070c9 authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands: Made SetOption override existing values (even if they used a different alias)

parent 10837a6d
......@@ -81,6 +81,21 @@ func (r *request) Options() map[string]interface{} {
// SetOption sets the value of the option for given name.
func (r *request) SetOption(name string, val interface{}) {
// find the option with the specified name
option, found := r.optionDefs[name]
if !found {
return
}
// try all the possible names, if we already have a value then set over it
for _, n := range option.Names {
val, found := r.options[n]
if found {
r.options[n] = val
return
}
}
r.options[name] = val
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment