make kuba happy
This commit is contained in:
parent
80b40e7e70
commit
de947a949f
@ -4,6 +4,9 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-lotus/chain/address"
|
"github.com/filecoin-project/go-lotus/chain/address"
|
||||||
types "github.com/filecoin-project/go-lotus/chain/types"
|
types "github.com/filecoin-project/go-lotus/chain/types"
|
||||||
@ -149,13 +152,24 @@ var walletImport = &cli.Command{
|
|||||||
defer closer()
|
defer closer()
|
||||||
ctx := ReqContext(cctx)
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
if !cctx.Args().Present() {
|
var data []byte
|
||||||
return fmt.Errorf("must specify key import data")
|
if !cctx.Args().Present() || cctx.Args().First() == "-" {
|
||||||
}
|
indata, err := ioutil.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dec, err := hex.DecodeString(strings.TrimSpace(string(indata)))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
data, err := hex.DecodeString(cctx.Args().First())
|
data = dec
|
||||||
if err != nil {
|
} else {
|
||||||
return err
|
fdata, err := ioutil.ReadFile(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
data = fdata
|
||||||
}
|
}
|
||||||
|
|
||||||
var ki types.KeyInfo
|
var ki types.KeyInfo
|
||||||
|
Loading…
Reference in New Issue
Block a user