Commit 7f807937 authored by chenminjian's avatar chenminjian

refact(cmd/patch): change string to const

License: MIT
Signed-off-by: default avatarchenminjian <727180553@qq.com>
parent de0bbb00
......@@ -167,6 +167,10 @@ Remove a Merkle-link from the given object and return the hash of the result.
},
}
const (
createOptionName = "create"
)
var patchAddLinkCmd = &cmds.Command{
Helptext: cmdkit.HelpText{
Tagline: "Add a link to a given object.",
......@@ -189,7 +193,7 @@ to a file containing 'bar', and returns the hash of the new object.
cmdkit.StringArg("ref", true, false, "IPFS object to add link to."),
},
Options: []cmdkit.Option{
cmdkit.BoolOption("create", "p", "Create intermediary nodes."),
cmdkit.BoolOption(createOptionName, "p", "Create intermediary nodes."),
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
api, err := cmdenv.GetApi(env, req)
......@@ -209,7 +213,7 @@ to a file containing 'bar', and returns the hash of the new object.
return err
}
create, _ := req.Options["create"].(bool)
create, _ := req.Options[createOptionName].(bool)
if err != nil {
return err
}
......
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