Commit 41d0852d authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

commands: Added Request#Options so consumers can iterate through provided options

parent 32a10ebc
......@@ -13,6 +13,7 @@ type optMap map[string]interface{}
type Request interface {
Path() []string
Option(name string) (interface{}, bool)
Options() map[string]interface{}
SetOption(name string, val interface{})
Arguments() []string
Stream() io.Reader
......@@ -39,6 +40,15 @@ func (r *request) Option(name string) (interface{}, bool) {
return val, err
}
// Options returns a copy of the option map
func (r *request) Options() map[string]interface{} {
output := make(optMap)
for k, v := range r.options {
output[k] = v
}
return output
}
// SetOption sets the value of the option for given name.
func (r *request) SetOption(name string, val interface{}) {
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