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
This commit is contained in:
parent
e9b5e22ad1
commit
db9b2f5405
|
@ -20,6 +20,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
@ -34,7 +35,7 @@ func main() {
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "network",
|
Name: "network",
|
||||||
Usage: "name of the network to administer",
|
Usage: "name of the network to administer (no spaces or hyphens, please)",
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "loglevel",
|
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))))
|
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(c.Int("loglevel")), log.StreamHandler(os.Stdout, log.TerminalFormat(true))))
|
||||||
rand.Seed(time.Now().UnixNano())
|
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
|
// Start the wizard and relinquish control
|
||||||
makeWizard(c.String("network")).run()
|
makeWizard(c.String("network")).run()
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue