better doc strings
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jan 3, 2016 at 12:57 UTC
4dca1f240ffd65600f1598650d316f93df0cbf6c
1 file changed
+19
-25
core/commands/object/patch.go
+19
-25
@@ -20,29 +20,8 @@ var ObjectPatchCmd = &cmds.Command{
20
Tagline: "Create a new merkledag object based on an existing one",
21
ShortDescription: `
22
'ipfs object patch <root> <cmd> <args>' is a plumbing command used to
23
-build custom DAG objects. It adds and removes links from objects, creating a new
24
-object as a result. This is the merkle-dag version of modifying an object. It
25
-can also set the data inside a node with 'set-data' and append to that data as
26
-well with 'append-data'.
27
-
28
-Patch commands:
29
- add-link <name> <ref> - adds a link to a node
30
- rm-link <name> - removes a link from a node
31
- set-data - sets a nodes data from stdin
32
- append-data - appends to a nodes data from stdin
33
-
34
-
35
-
36
- ipfs object patch $FOO_BAR rm-link foo
37
-
38
-This removes the link named foo from the hash in $FOO_BAR and returns the
39
-resulting object hash.
40
-
41
-The data inside the node can be modified as well:
42
-
43
- ipfs object patch $FOO_BAR set-data < file.dat
44
- ipfs object patch $FOO_BAR append-data < file.dat
45
-
23
+build custom DAG objects. It mutates objects, creating new objects as a
24
+result. This is the merkle-dag version of modifying an object.
25
`,
26
},
27
Arguments: []cmds.Argument{},
@@ -67,7 +46,15 @@ var patchAppendDataCmd = &cmds.Command{
46
Helptext: cmds.HelpText{
47
Tagline: "Append data to the data segment of a dag node",
48
ShortDescription: `
70
- `,
49
+Append data to what already exists in the data segment in the given object.
50
+
51
+EXAMPLE:
52
+ $ echo "hello" | ipfs object patch $HASH append-data
53
+
54
+note: this does not append data to a 'file', it modifies the actual raw
55
+data within an object. Objects have a max size of 1MB and objects larger than
56
+the limit will not be respected by the network.
57
+`,
58
},
59
Arguments: []cmds.Argument{
60
cmds.StringArg("root", true, false, "the hash of the node to modify"),
@@ -162,7 +149,12 @@ var patchSetDataCmd = &cmds.Command{
149
}
150
151
var patchRmLinkCmd = &cmds.Command{
165
- Helptext: cmds.HelpText{},
152
+ Helptext: cmds.HelpText{
153
+ Tagline: "remove a link from an object",
154
+ ShortDescription: `
155
+removes a link by the given name from root.
156
+`,
157
+ },
158
Arguments: []cmds.Argument{
159
cmds.StringArg("root", true, false, "the hash of the node to modify"),
160
cmds.StringArg("link", true, false, "name of the link to remove"),
@@ -220,6 +212,8 @@ var patchAddLinkCmd = &cmds.Command{
212
Helptext: cmds.HelpText{
213
Tagline: "add a link to a given object",
214
ShortDescription: `
215
+Add a merkle-link to the given object and return the hash of the result.
216
+
217
Examples:
218
219
EMPTY_DIR=$(ipfs object new unixfs-dir)