mirror of https://github.com/poanetwork/gecko.git
add --version CLI that prints version and quits
This commit is contained in:
parent
425817a36d
commit
670227d318
|
@ -87,6 +87,9 @@ func init() {
|
|||
|
||||
fs := flag.NewFlagSet("gecko", flag.ContinueOnError)
|
||||
|
||||
// If this is true, print the version and quit.
|
||||
version := fs.Bool("version", false, "If true, print version and quit")
|
||||
|
||||
// NetworkID:
|
||||
networkName := fs.String("network-id", genesis.TestnetName, "Network ID this node will connect to")
|
||||
|
||||
|
@ -152,6 +155,11 @@ func init() {
|
|||
|
||||
ferr := fs.Parse(os.Args[1:])
|
||||
|
||||
if *version { // If --version used, print version and exit
|
||||
fmt.Println(node.Version.String())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if ferr == flag.ErrHelp {
|
||||
// display usage/help text and exit successfully
|
||||
os.Exit(0)
|
||||
|
|
|
@ -55,7 +55,8 @@ const (
|
|||
var (
|
||||
genesisHashKey = []byte("genesisID")
|
||||
|
||||
nodeVersion = version.NewDefaultVersion("avalanche", 0, 5, 1)
|
||||
// Version is the version of this code
|
||||
Version = version.NewDefaultVersion("avalanche", 0, 5, 1)
|
||||
versionParser = version.NewDefaultParser()
|
||||
)
|
||||
|
||||
|
@ -156,7 +157,7 @@ func (n *Node) initNetworking() error {
|
|||
n.ID,
|
||||
n.Config.StakingIP,
|
||||
n.Config.NetworkID,
|
||||
nodeVersion,
|
||||
Version,
|
||||
versionParser,
|
||||
listener,
|
||||
dialer,
|
||||
|
@ -525,7 +526,7 @@ func (n *Node) Initialize(Config *Config, logger logging.Logger, logFactory logg
|
|||
n.Log = logger
|
||||
n.LogFactory = logFactory
|
||||
n.Config = Config
|
||||
n.Log.Info("Gecko version is: %s", nodeVersion)
|
||||
n.Log.Info("Gecko version is: %s", Version)
|
||||
|
||||
httpLog, err := logFactory.MakeSubdir("http")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue