@@ -48,7 +48,7 @@ The optional format string is a printf style format string:
48
48
` + cidutil .FormatRef ,
49
49
},
50
50
Arguments : []cmds.Argument {
51
- cmds .StringArg ("cid" , true , true , "Cids to format." ).EnableStdin (),
51
+ cmds .StringArg ("cid" , true , true , "CIDs to format." ).EnableStdin (),
52
52
},
53
53
Options : []cmds.Option {
54
54
cmds .StringOption (cidFormatOptionName , "Printf style format string." ).WithDefault ("%s" ),
@@ -65,14 +65,14 @@ The optional format string is a printf style format string:
65
65
opts := cidFormatOpts {}
66
66
67
67
if strings .IndexByte (fmtStr , '%' ) == - 1 {
68
- return fmt .Errorf ("invalid format string: %s " , fmtStr )
68
+ return fmt .Errorf ("invalid format string: %q " , fmtStr )
69
69
}
70
70
opts .fmtStr = fmtStr
71
71
72
72
if codecStr != "" {
73
73
codec , ok := cid .Codecs [codecStr ]
74
74
if ! ok {
75
- return fmt .Errorf ("unknown IPLD codec: %s " , codecStr )
75
+ return fmt .Errorf ("unknown IPLD codec: %q " , codecStr )
76
76
}
77
77
opts .newCodec = codec
78
78
} // otherwise, leave it as 0 (not a valid IPLD codec)
@@ -82,13 +82,13 @@ The optional format string is a printf style format string:
82
82
// noop
83
83
case "0" :
84
84
if opts .newCodec != 0 && opts .newCodec != cid .DagProtobuf {
85
- return fmt .Errorf ("cannot convert to CIDv0 with any codec other than DagPB " )
85
+ return fmt .Errorf ("cannot convert to CIDv0 with any codec other than dag-pb " )
86
86
}
87
87
opts .verConv = toCidV0
88
88
case "1" :
89
89
opts .verConv = toCidV1
90
90
default :
91
- return fmt .Errorf ("invalid cid version: %s " , verStr )
91
+ return fmt .Errorf ("invalid cid version: %q " , verStr )
92
92
}
93
93
94
94
if baseStr != "" {
@@ -125,9 +125,13 @@ type CidFormatRes struct {
125
125
var base32Cmd = & cmds.Command {
126
126
Helptext : cmds.HelpText {
127
127
Tagline : "Convert CIDs to Base32 CID version 1." ,
128
+ ShortDescription : `
129
+ 'ipfs cid base32' normalizes passes CIDs to their canonical case-insensitive encoding.
130
+ Useful when processing third-party CIDs which could come with arbitrary formats.
131
+ ` ,
128
132
},
129
133
Arguments : []cmds.Argument {
130
- cmds .StringArg ("cid" , true , true , "Cids to convert." ).EnableStdin (),
134
+ cmds .StringArg ("cid" , true , true , "CIDs to convert." ).EnableStdin (),
131
135
},
132
136
Run : func (req * cmds.Request , resp cmds.ResponseEmitter , env cmds.Environment ) error {
133
137
opts := cidFormatOpts {
@@ -234,7 +238,7 @@ func emitCids(req *cmds.Request, resp cmds.ResponseEmitter, opts cidFormatOpts)
234
238
235
239
func toCidV0 (c cid.Cid ) (cid.Cid , error ) {
236
240
if c .Type () != cid .DagProtobuf {
237
- return cid.Cid {}, fmt .Errorf ("can't convert non-protobuf nodes to cidv0" )
241
+ return cid.Cid {}, fmt .Errorf ("can't convert non-dag-pb nodes to cidv0" )
238
242
}
239
243
return cid .NewCidV0 (c .Hash ()), nil
240
244
}
@@ -256,6 +260,9 @@ const (
256
260
var basesCmd = & cmds.Command {
257
261
Helptext : cmds.HelpText {
258
262
Tagline : "List available multibase encodings." ,
263
+ ShortDescription : `
264
+ 'ipfs cid bases' relies on https://github.com/multiformats/go-multibase
265
+ ` ,
259
266
},
260
267
Options : []cmds.Option {
261
268
cmds .BoolOption (prefixOptionName , "also include the single letter prefixes in addition to the code" ),
@@ -305,6 +312,9 @@ const (
305
312
var codecsCmd = & cmds.Command {
306
313
Helptext : cmds.HelpText {
307
314
Tagline : "List available CID codecs." ,
315
+ ShortDescription : `
316
+ 'ipfs cid codecs' relies on https://github.com/multiformats/go-multicodec
317
+ ` ,
308
318
},
309
319
Options : []cmds.Option {
310
320
cmds .BoolOption (codecsNumericOptionName , "n" , "also include numeric codes" ),
@@ -355,6 +365,9 @@ var codecsCmd = &cmds.Command{
355
365
var hashesCmd = & cmds.Command {
356
366
Helptext : cmds.HelpText {
357
367
Tagline : "List available multihashes." ,
368
+ ShortDescription : `
369
+ 'ipfs cid hashes' relies on https://github.com/multiformats/go-multihash
370
+ ` ,
358
371
},
359
372
Options : codecsCmd .Options ,
360
373
Run : func (req * cmds.Request , resp cmds.ResponseEmitter , env cmds.Environment ) error {
0 commit comments