github.com/n1ghtfa1l/go-vnt@v0.6.4-alpha.6/cmd/gvnt/misccmd.go (about)

     1  // Copyright 2016 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  
    17  package main
    18  
    19  import (
    20  	"fmt"
    21  	"os"
    22  	"runtime"
    23  	"strings"
    24  
    25  	"github.com/vntchain/go-vnt/cmd/utils"
    26  	"github.com/vntchain/go-vnt/params"
    27  	"github.com/vntchain/go-vnt/vnt"
    28  	"gopkg.in/urfave/cli.v1"
    29  )
    30  
    31  var (
    32  	versionCommand = cli.Command{
    33  		Action:    utils.MigrateFlags(version),
    34  		Name:      "version",
    35  		Usage:     "Print version numbers",
    36  		ArgsUsage: " ",
    37  		Category:  "MISCELLANEOUS COMMANDS",
    38  		Description: `
    39  The output of this command is supposed to be machine-readable.
    40  `,
    41  	}
    42  	licenseCommand = cli.Command{
    43  		Action:    utils.MigrateFlags(license),
    44  		Name:      "license",
    45  		Usage:     "Display license information",
    46  		ArgsUsage: " ",
    47  		Category:  "MISCELLANEOUS COMMANDS",
    48  	}
    49  )
    50  
    51  func version(ctx *cli.Context) error {
    52  	fmt.Println(strings.Title(clientIdentifier))
    53  	fmt.Println("Version:", params.Version)
    54  	if gitCommit != "" {
    55  		fmt.Println("Git Commit:", gitCommit)
    56  	}
    57  	fmt.Println("Architecture:", runtime.GOARCH)
    58  	fmt.Println("Protocol Versions:", vnt.ProtocolVersions)
    59  	fmt.Println("Network Id:", vnt.DefaultConfig.NetworkId)
    60  	fmt.Println("Go Version:", runtime.Version())
    61  	fmt.Println("Operating System:", runtime.GOOS)
    62  	fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH"))
    63  	fmt.Printf("GOROOT=%s\n", runtime.GOROOT())
    64  	return nil
    65  }
    66  
    67  func license(_ *cli.Context) error {
    68  	fmt.Println(`Gvnt is free software: you can redistribute it and/or modify
    69  it under the terms of the GNU General Public License as published by
    70  the Free Software Foundation, either version 3 of the License, or
    71  (at your option) any later version.
    72  
    73  Gvnt is distributed in the hope that it will be useful,
    74  but WITHOUT ANY WARRANTY; without even the implied warranty of
    75  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    76  GNU General Public License for more details.
    77  
    78  You should have received a copy of the GNU General Public License
    79  along with gvnt. If not, see <http://www.gnu.org/licenses/>.`)
    80  	return nil
    81  }