diff options
author | Zhenguo Niu <Niu.ZGlinux@gmail.com> | 2018-03-26 20:21:20 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-03-26 20:21:20 +0800 |
commit | db9b2f5405643b3584eaa90b05a3dbfa19d717fb (patch) | |
tree | 4c0ef4019b72a5f3edc59ef75ec1358ad10bf009 | |
parent | e9b5e22ad121ef2251d1c72526c0994c03d2caf0 (diff) | |
download | dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar.gz dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar.bz2 dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar.lz dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar.xz dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.tar.zst dexon-db9b2f5405643b3584eaa90b05a3dbfa19d717fb.zip |
cmd/puppeth: add constraints to network name (#16336)
* cmd/puppeth: add constraints to network name
* cmd/puppeth: update usage of network arg
* cmd/puppeth: avoid package dependency on utils
-rw-r--r-- | cmd/puppeth/puppeth.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/puppeth/puppeth.go b/cmd/puppeth/puppeth.go index 26382dac1..f9b8fe481 100644 --- a/cmd/puppeth/puppeth.go +++ b/cmd/puppeth/puppeth.go @@ -20,6 +20,7 @@ package main import ( "math/rand" "os" + "strings" "time" "github.com/ethereum/go-ethereum/log" @@ -34,7 +35,7 @@ func main() { app.Flags = []cli.Flag{ cli.StringFlag{ Name: "network", - Usage: "name of the network to administer", + Usage: "name of the network to administer (no spaces or hyphens, please)", }, cli.IntFlag{ Name: "loglevel", @@ -47,6 +48,10 @@ func main() { log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int("loglevel")), log.StreamHandler(os.Stdout, log.TerminalFormat(true)))) rand.Seed(time.Now().UnixNano()) + network := c.String("network") + if strings.Contains(network, " ") || strings.Contains(network, "-") { + log.Crit("No spaces or hyphens allowed in network name") + } // Start the wizard and relinquish control makeWizard(c.String("network")).run() return nil |