Commit 0b8e0327 authored by Kevin Atkinson's avatar Kevin Atkinson

add cmd: use .Default(true) for pin option.

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent aa97a09b
...@@ -76,7 +76,7 @@ You can now refer to the added file in a gateway, like so: ...@@ -76,7 +76,7 @@ You can now refer to the added file in a gateway, like so:
cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."), cmds.BoolOption(wrapOptionName, "w", "Wrap files with a directory object."),
cmds.BoolOption(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."), cmds.BoolOption(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."),
cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm to use."), cmds.StringOption(chunkerOptionName, "s", "Chunking algorithm to use."),
cmds.BoolOption(pinOptionName, "Pin this object when adding. Default: true."), cmds.BoolOption(pinOptionName, "Pin this object when adding.").Default(true),
cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"), cmds.BoolOption(rawLeavesOptionName, "Use raw blocks for leaf nodes. (experimental)"),
}, },
PreRun: func(req cmds.Request) error { PreRun: func(req cmds.Request) error {
...@@ -135,13 +135,9 @@ You can now refer to the added file in a gateway, like so: ...@@ -135,13 +135,9 @@ You can now refer to the added file in a gateway, like so:
hidden, _, _ := req.Option(hiddenOptionName).Bool() hidden, _, _ := req.Option(hiddenOptionName).Bool()
silent, _, _ := req.Option(silentOptionName).Bool() silent, _, _ := req.Option(silentOptionName).Bool()
chunker, _, _ := req.Option(chunkerOptionName).String() chunker, _, _ := req.Option(chunkerOptionName).String()
dopin, pin_found, _ := req.Option(pinOptionName).Bool() dopin, _, _ := req.Option(pinOptionName).Bool()
rawblks, _, _ := req.Option(rawLeavesOptionName).Bool() rawblks, _, _ := req.Option(rawLeavesOptionName).Bool()
if !pin_found { // default
dopin = true
}
if hash { if hash {
nilnode, err := core.NewNode(n.Context(), &core.BuildCfg{ nilnode, err := core.NewNode(n.Context(), &core.BuildCfg{
//TODO: need this to be true or all files //TODO: need this to be true or all files
......
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