main.go 1.5 KB

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