From 0b8e03278505a6ffcfef5eb0eeae013122b7ce5b Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Sat, 3 Dec 2016 23:39:13 -0500 Subject: [PATCH] add cmd: use .Default(true) for pin option. License: MIT Signed-off-by: Kevin Atkinson --- core/commands/add.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/commands/add.go b/core/commands/add.go index 3ee0d816c..8d6e59099 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -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(hiddenOptionName, "H", "Include files that are hidden. Only takes effect on recursive add."), 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)"), }, PreRun: func(req cmds.Request) error { @@ -135,13 +135,9 @@ You can now refer to the added file in a gateway, like so: hidden, _, _ := req.Option(hiddenOptionName).Bool() silent, _, _ := req.Option(silentOptionName).Bool() chunker, _, _ := req.Option(chunkerOptionName).String() - dopin, pin_found, _ := req.Option(pinOptionName).Bool() + dopin, _, _ := req.Option(pinOptionName).Bool() rawblks, _, _ := req.Option(rawLeavesOptionName).Bool() - if !pin_found { // default - dopin = true - } - if hash { nilnode, err := core.NewNode(n.Context(), &core.BuildCfg{ //TODO: need this to be true or all files