github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/cmd/quickchain/misccmd.go (about)

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