Skip to content

Commit 141bdd3

Browse files
committed
refactor: use Status: cmds.Removed
This allows us to return meaningful error to end users who were not aware of deprecation, and also produce useful removal notice at https://docs.ipfs.tech/reference/kubo/rpc/
1 parent 7daa23c commit 141bdd3

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

core/commands/commands_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,18 @@ func TestCommands(t *testing.T) {
120120
"/name/pubsub/subs",
121121
"/name/resolve",
122122
"/object",
123+
"/object/data",
123124
"/object/diff",
125+
"/object/get",
126+
"/object/links",
127+
"/object/new",
124128
"/object/patch",
125129
"/object/patch/add-link",
130+
"/object/patch/append-data",
126131
"/object/patch/rm-link",
132+
"/object/patch/set-data",
133+
"/object/put",
134+
"/object/stat",
127135
"/p2p",
128136
"/p2p/close",
129137
"/p2p/forward",

core/commands/object/object.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,23 @@ directly. Deprecated, use more modern 'ipfs dag' and 'ipfs files' instead.`,
2828
},
2929

3030
Subcommands: map[string]*cmds.Command{
31+
"data": RemovedObjectCmd,
3132
"diff": ObjectDiffCmd,
33+
"get": RemovedObjectCmd,
34+
"links": RemovedObjectCmd,
35+
"new": RemovedObjectCmd,
3236
"patch": ObjectPatchCmd,
37+
"put": RemovedObjectCmd,
38+
"stat": RemovedObjectCmd,
39+
},
40+
}
41+
42+
var RemovedObjectCmd = &cmds.Command{
43+
Status: cmds.Removed,
44+
Helptext: cmds.HelpText{
45+
Tagline: "Removed, use 'ipfs dag' or 'ipfs files' instead.",
46+
},
47+
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
48+
return errors.New("Removed, use 'ipfs dag' or 'ipfs files' instead")
3349
},
3450
}

core/commands/object/patch.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ For modern use cases, use MFS with 'files' commands: 'ipfs files --help'.
3737
},
3838
Arguments: []cmds.Argument{},
3939
Subcommands: map[string]*cmds.Command{
40-
"add-link": patchAddLinkCmd,
41-
"rm-link": patchRmLinkCmd,
40+
"append-data": RemovedObjectCmd,
41+
"add-link": patchAddLinkCmd,
42+
"rm-link": patchRmLinkCmd,
43+
"set-data": RemovedObjectCmd,
4244
},
4345
Options: []cmds.Option{
4446
cmdutils.AllowBigBlockOption,

0 commit comments

Comments
 (0)