main.go 1.6 KB

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