@@ -43,6 +43,7 @@ const (
4343 fstoreCacheOptionName = "fscache"
4444 cidVersionOptionName = "cid-version"
4545 hashOptionName = "hash"
46+ pinPathOptionName = "pinpath"
4647)
4748
4849const adderOutChanSize = 8
@@ -114,6 +115,7 @@ You can now check what blocks have been created by:
114115 cmdkit .BoolOption (hiddenOptionName , "H" , "Include files that are hidden. Only takes effect on recursive add." ),
115116 cmdkit .StringOption (chunkerOptionName , "s" , "Chunking algorithm, size-[bytes] or rabin-[min]-[avg]-[max]" ).WithDefault ("size-262144" ),
116117 cmdkit .BoolOption (pinOptionName , "Pin this object when adding." ).WithDefault (true ),
118+ cmdkit .StringOption (pinPathOptionName , "P" , "Pin object under this path. Implies --pin=true" ).WithDefault ("" ),
117119 cmdkit .BoolOption (rawLeavesOptionName , "Use raw blocks for leaf nodes. (experimental)" ),
118120 cmdkit .BoolOption (noCopyOptionName , "Add the file using filestore. Implies raw-leaves. (experimental)" ),
119121 cmdkit .BoolOption (fstoreCacheOptionName , "Check the filestore for pre-existing blocks. (experimental)" ),
@@ -172,6 +174,7 @@ You can now check what blocks have been created by:
172174 fscache , _ := req .Options [fstoreCacheOptionName ].(bool )
173175 cidVer , cidVerSet := req .Options [cidVersionOptionName ].(int )
174176 hashFunStr , _ := req .Options [hashOptionName ].(string )
177+ pinPath , _ := req .Options [pinPathOptionName ].(string )
175178
176179 // The arguments are subject to the following constraints.
177180 //
@@ -280,6 +283,11 @@ You can now check what blocks have been created by:
280283 fileAdder .RawLeaves = rawblks
281284 fileAdder .NoCopy = nocopy
282285 fileAdder .Prefix = & prefix
286+ if pinPath == "" {
287+ fileAdder .PinPath = "added/"
288+ } else {
289+ fileAdder .PinPath = pinPath
290+ }
283291
284292 if hash {
285293 md := dagtest .Mock ()
0 commit comments