提交 6aa8525f 作者: Ryan Carver

object patch rm-link: change arg from 'link' to 'name'

This improves the semantics of rm-link to be consistent with add-link,
clarifying that you should specify the link name as the thing to remove.

License: MIT
Signed-off-by: 's avatarRyan Carver <ryan@ryancarver.com>
上级 d3bba25f
...@@ -145,14 +145,14 @@ Example: ...@@ -145,14 +145,14 @@ Example:
var patchRmLinkCmd = &oldcmds.Command{ var patchRmLinkCmd = &oldcmds.Command{
Helptext: cmdkit.HelpText{ Helptext: cmdkit.HelpText{
Tagline: "Remove a link from an object.", Tagline: "Remove a link from a given object.",
ShortDescription: ` ShortDescription: `
Removes a link by the given name from root. Remove a Merkle-link from the given object and return the hash of the result.
`, `,
}, },
Arguments: []cmdkit.Argument{ Arguments: []cmdkit.Argument{
cmdkit.StringArg("root", true, false, "The hash of the node to modify."), cmdkit.StringArg("root", true, false, "The hash of the node to modify."),
cmdkit.StringArg("link", true, false, "Name of the link to remove."), cmdkit.StringArg("name", true, false, "Name of the link to remove."),
}, },
Run: func(req oldcmds.Request, res oldcmds.Response) { Run: func(req oldcmds.Request, res oldcmds.Response) {
api, err := req.InvocContext().GetApi() api, err := req.InvocContext().GetApi()
...@@ -167,8 +167,8 @@ Removes a link by the given name from root. ...@@ -167,8 +167,8 @@ Removes a link by the given name from root.
return return
} }
link := req.Arguments()[1] name := req.Arguments()[1]
p, err := api.Object().RmLink(req.Context(), root, link) p, err := api.Object().RmLink(req.Context(), root, name)
if err != nil { if err != nil {
res.SetError(err, cmdkit.ErrNormal) res.SetError(err, cmdkit.ErrNormal)
return return
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论