1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-22 12:51:19 +08:00

uodate json option name

License: MIT
Signed-off-by: Kejie Zhang <601172892@qq.com>
This commit is contained in:
Kejie Zhang
2018-10-05 10:59:01 +08:00
parent dee54b36d9
commit 371bf9310e

View File

@ -27,7 +27,7 @@ type ConfigField struct {
const (
configBoolOptionName = "bool"
configJsonOptionName = "json"
configJSONOptionName = "json"
)
var ConfigCmd = &cmds.Command{
@ -60,7 +60,7 @@ Set the value of the 'Datastore.Path' key:
},
Options: []cmdkit.Option{
cmdkit.BoolOption(configBoolOptionName, "Set a boolean value."),
cmdkit.BoolOption(configJsonOptionName, "Parse stringified JSON."),
cmdkit.BoolOption(configJSONOptionName, "Parse stringified JSON."),
},
Run: func(req cmds.Request, res cmds.Response) {
args := req.Arguments()
@ -92,7 +92,7 @@ Set the value of the 'Datastore.Path' key:
if len(args) == 2 {
value := args[1]
if parseJson, _, _ := req.Option(configJsonOptionName).Bool(); parseJson {
if parseJSON, _, _ := req.Option(configJSONOptionName).Bool(); parseJSON {
var jsonVal interface{}
if err := json.Unmarshal([]byte(value), &jsonVal); err != nil {
err = fmt.Errorf("failed to unmarshal json. %s", err)