change flag codec value raw to id and default value is id

This commit is contained in:
zgfzgf 2020-12-02 08:41:58 +08:00
parent 715c32ff77
commit 97dd082585

View File

@ -32,8 +32,8 @@ var cidIdCmd = &cli.Command{
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "codec", Name: "codec",
Value: "abi", Value: "id",
Usage: "multicodec-packed content types: abi or raw", Usage: "multicodec-packed content types: abi or id",
}, },
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
@ -66,7 +66,7 @@ var cidIdCmd = &cli.Command{
return xerrors.Errorf("cidBuilder abi: %w", err) return xerrors.Errorf("cidBuilder abi: %w", err)
} }
fmt.Println(aCid) fmt.Println(aCid)
case "raw": case "id":
builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY} builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY}
rCid, err := builder.Sum(dec) rCid, err := builder.Sum(dec)
if err != nil { if err != nil {