add keygen outfile

This commit is contained in:
Frank 2020-12-04 18:39:35 +08:00
parent b13226bc2f
commit daca99687c
3 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View File

@ -13,6 +13,7 @@
/lotus-gateway
/lotus-pcr
/lotus-wallet
/lotus-keygen
/bench.json
/lotuspond/front/node_modules
/lotuspond/front/build

View File

@ -204,6 +204,12 @@ lotus-wallet:
.PHONY: lotus-wallet
BINS+=lotus-wallet
lotus-keygen:
rm -f lotus-keygen
go build -o lotus-keygen ./cmd/lotus-keygen
.PHONY: lotus-keygen
BINS+=lotus-keygen
testground:
go build -tags testground -o /dev/null ./cmd/lotus
.PHONY: testground

View File

@ -22,6 +22,11 @@ func main() {
Value: "bls",
Usage: "specify key type to generate (bls or secp256k1)",
},
&cli.StringFlag{
Name: "out",
Aliases: []string{"o"},
Usage: "specify key file name to generate",
},
}
app.Action = func(cctx *cli.Context) error {
memks := wallet.NewMemKeyStore()
@ -50,7 +55,11 @@ func main() {
return err
}
fi, err := os.Create(fmt.Sprintf("%s.key", kaddr))
outFile := fmt.Sprintf("%s.key", kaddr)
if cctx.IsSet("out") {
outFile = fmt.Sprintf("%s.key", cctx.String("out"))
}
fi, err := os.Create(outFile)
if err != nil {
return err
}