main.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 gitDate = ""
  29. var app *cli.App
  30. func init() {
  31. app = utils.NewApp(gitCommit, gitDate, "an Ethereum key manager")
  32. app.Commands = []cli.Command{
  33. commandGenerate,
  34. commandInspect,
  35. commandChangePassphrase,
  36. commandSignMessage,
  37. commandVerifyMessage,
  38. }
  39. }
  40. // Commonly used command line flags.
  41. var (
  42. passphraseFlag = cli.StringFlag{
  43. Name: "passwordfile",
  44. Usage: "the file that contains the passphrase for the keyfile",
  45. }
  46. jsonFlag = cli.BoolFlag{
  47. Name: "json",
  48. Usage: "output JSON instead of human-readable format",
  49. }
  50. )
  51. func main() {
  52. if err := app.Run(os.Args); err != nil {
  53. fmt.Fprintln(os.Stderr, err)
  54. os.Exit(1)
  55. }
  56. }