Skip to content

Commit

Permalink
uodate json option name
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kejie Zhang <601172892@qq.com>
  • Loading branch information
kjzz committed Oct 5, 2018
1 parent fad3f02 commit 8970667
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type ConfigField struct {

const (
configBoolOptionName = "bool"
configJsonOptionName = "json"
configJSONOptionName = "json"
)

var ConfigCmd = &cmds.Command{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8970667

Please sign in to comment.