Commit c68aa06c authored by Richard Littauer's avatar Richard Littauer

Added Default logic to object object and patch

Part of #2484.

License: MIT
Signed-off-by: default avatarRichard Littauer <richard.littauer@gmail.com>
parent a2bcec40
......@@ -113,7 +113,7 @@ multihash.
cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format.").EnableStdin(),
},
Options: []cmds.Option{
cmds.BoolOption("headers", "v", "Print table headers (Hash, Size, Name)."),
cmds.BoolOption("headers", "v", "Print table headers (Hash, Size, Name).").Default(false),
},
Run: func(req cmds.Request, res cmds.Response) {
n, err := req.InvocContext().GetNode()
......@@ -335,7 +335,7 @@ And then run:
cmds.FileArg("data", true, false, "Data to be stored as a DAG object.").EnableStdin(),
},
Options: []cmds.Option{
cmds.StringOption("inputenc", "Encoding type of input data, either \"protobuf\" or \"json\"."),
cmds.StringOption("inputenc", "Encoding type of input data. One of: {\"protobuf\", \"json\"}.").Default("json"),
cmds.StringOption("datafieldenc", "Encoding type of the data field, either \"text\" or \"base64\".").Default("text"),
},
Run: func(req cmds.Request, res cmds.Response) {
......@@ -351,16 +351,13 @@ And then run:
return
}
inputenc, found, err := req.Option("inputenc").String()
inputenc, _, err := req.Option("inputenc").String()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
if !found {
inputenc = "json"
}
datafieldenc, found, err := req.Option("datafieldenc").String()
datafieldenc, _, err := req.Option("datafieldenc").String()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
......
......@@ -246,14 +246,14 @@ This takes an empty directory, and adds a link named 'foo' under it, pointing to
a file containing 'bar', and returns the hash of the new object.
`,
},
Options: []cmds.Option{
cmds.BoolOption("p", "create", "Create intermediary nodes."),
},
Arguments: []cmds.Argument{
cmds.StringArg("root", true, false, "The hash of the node to modify."),
cmds.StringArg("name", true, false, "Name of link to create."),
cmds.StringArg("ref", true, false, "IPFS object to add link to."),
},
Options: []cmds.Option{
cmds.BoolOption("p", "create", "Create intermediary nodes.").Default(false),
},
Run: func(req cmds.Request, res cmds.Response) {
nd, err := req.InvocContext().GetNode()
if err != nil {
......
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