github.com/aigarnetwork/aigar@v0.0.0-20191115204914-d59a6eb70f8e/cmd/ethkey/main.go (about) 1 // Copyright 2018 The go-ethereum Authors 2 // Copyright 2019 The go-aigar Authors 3 // This file is part of the go-aigar library. 4 // 5 // The go-aigar library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // The go-aigar library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public License 16 // along with the go-aigar library. If not, see <http://www.gnu.org/licenses/>. 17 18 package main 19 20 import ( 21 "fmt" 22 "os" 23 24 "github.com/AigarNetwork/aigar/cmd/utils" 25 "gopkg.in/urfave/cli.v1" 26 ) 27 28 const ( 29 defaultKeyfileName = "keyfile.json" 30 ) 31 32 // Git SHA1 commit hash of the release (set via linker flags) 33 var gitCommit = "" 34 var gitDate = "" 35 36 var app *cli.App 37 38 func init() { 39 app = utils.NewApp(gitCommit, gitDate, "an Ethereum key manager") 40 app.Commands = []cli.Command{ 41 commandGenerate, 42 commandInspect, 43 commandChangePassphrase, 44 commandSignMessage, 45 commandVerifyMessage, 46 } 47 } 48 49 // Commonly used command line flags. 50 var ( 51 passphraseFlag = cli.StringFlag{ 52 Name: "passwordfile", 53 Usage: "the file that contains the password for the keyfile", 54 } 55 jsonFlag = cli.BoolFlag{ 56 Name: "json", 57 Usage: "output JSON instead of human-readable format", 58 } 59 ) 60 61 func main() { 62 if err := app.Run(os.Args); err != nil { 63 fmt.Fprintln(os.Stderr, err) 64 os.Exit(1) 65 } 66 }