Commit 79741438 authored by Matt Bell's avatar Matt Bell

core/commands: config: Simplified some syntax

parent 3fc9bedb
......@@ -68,24 +68,19 @@ Set the value of the 'datastore.path' key:
}
defer r.Close()
var value string
var err error
var output *ConfigField
if len(args) == 2 {
value = args[1]
output, err := setConfig(r, key, value)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
res.SetOutput(output)
value := args[1]
output, err = setConfig(r, key, value)
} else {
output, err := getConfig(r, key)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
res.SetOutput(output)
output, err = getConfig(r, key)
}
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
res.SetOutput(output)
},
Marshalers: cmds.MarshalerMap{
cmds.Text: func(res cmds.Response) (io.Reader, error) {
......
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