pin cmd: document pin ls output types
Michael Muré committed
Jul 11, 2019 at 14:05 UTC
4ec37b6f7ba672b3f68c4a4c75ce55c10fcfc7f2
1 file changed
+16
-12
core/commands/pin.go
+16
-12
@@ -393,24 +393,28 @@ Example:
393
},
394
}
395
396
-type PinLsObject struct {
397
- Cid string `json:",omitempty"`
398
- Type string `json:",omitempty"`
399
-}
400
-
401
-type PinLsType struct {
402
- Type string
396
+// PinLsOutputWrapper is the output type of the pin ls command.
397
+// Pin ls needs to output two different type depending on if it's streamed or not.
398
+// We use this to bypass the cmds lib refusing to have interface{}
399
+type PinLsOutputWrapper struct {
400
+ PinLsList
401
+ PinLsObject
402
}
403
404
+// PinLsList is a set of pins with their type
405
type PinLsList struct {
406
Keys map[string]PinLsType `json:",omitempty"`
407
}
408
409
-// Pin ls needs to output two different type depending on if it's streamed or not.
410
-// We use this to bypass the cmds lib refusing to have interface{}
411
-type PinLsOutputWrapper struct {
412
- PinLsList
413
- PinLsObject
409
+// PinLsType contains the type of a pin
410
+type PinLsType struct {
411
+ Type string
412
+}
413
+
414
+// PinLsObject contains the description of a pin
415
+type PinLsObject struct {
416
+ Cid string `json:",omitempty"`
417
+ Type string `json:",omitempty"`
418
}
419
420
func pinLsKeys(req *cmds.Request, typeStr string, n *core.IpfsNode, api coreiface.CoreAPI, emit func(value interface{}) error) error {