Merge pull request #847 from lanzafame/feat/accept-human-sizes
accept humanized size values to cli flags
This commit is contained in:
+9
-3
@@ -1,6 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/docker/go-units"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"golang.org/x/xerrors"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
@@ -10,13 +11,18 @@ var fetchParamCmd = &cli.Command{
|
||||
Name: "fetch-params",
|
||||
Usage: "Fetch proving parameters",
|
||||
Flags: []cli.Flag{
|
||||
&cli.Uint64Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "proving-params",
|
||||
Usage: "download params used creating proofs for given size",
|
||||
Usage: "download params used creating proofs for given size, i.e. 32GiB",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
err := build.GetParams(cctx.Uint64("proving-params"))
|
||||
sectorSizeInt, err := units.FromHumanSize(cctx.String("proving-params"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sectorSize := uint64(sectorSizeInt)
|
||||
err = build.GetParams(sectorSize)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("fetching proof parameters: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user