github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/cmd/ethkey/main.go (about)

     1  
     2  //<developer>
     3  //    <name>linapex 曹一峰</name>
     4  //    <email>linapex@163.com</email>
     5  //    <wx>superexc</wx>
     6  //    <qqgroup>128148617</qqgroup>
     7  //    <url>https://jsq.ink</url>
     8  //    <role>pku engineer</role>
     9  //    <date>2019-03-16 12:09:27</date>
    10  //</624342589390196736>
    11  
    12  
    13  package main
    14  
    15  import (
    16  	"fmt"
    17  	"os"
    18  
    19  	"github.com/ethereum/go-ethereum/cmd/utils"
    20  	"gopkg.in/urfave/cli.v1"
    21  )
    22  
    23  const (
    24  	defaultKeyfileName = "keyfile.json"
    25  )
    26  
    27  //git sha1提交发布的哈希(通过链接器标志设置)
    28  var gitCommit = ""
    29  
    30  var app *cli.App
    31  
    32  func init() {
    33  	app = utils.NewApp(gitCommit, "an Ethereum key manager")
    34  	app.Commands = []cli.Command{
    35  		commandGenerate,
    36  		commandInspect,
    37  		commandChangePassphrase,
    38  		commandSignMessage,
    39  		commandVerifyMessage,
    40  	}
    41  }
    42  
    43  //常用命令行标志。
    44  var (
    45  	passphraseFlag = cli.StringFlag{
    46  		Name:  "passwordfile",
    47  		Usage: "the file that contains the passphrase for the keyfile",
    48  	}
    49  	jsonFlag = cli.BoolFlag{
    50  		Name:  "json",
    51  		Usage: "output JSON instead of human-readable format",
    52  	}
    53  )
    54  
    55  func main() {
    56  	if err := app.Run(os.Args); err != nil {
    57  		fmt.Fprintln(os.Stderr, err)
    58  		os.Exit(1)
    59  	}
    60  }
    61