github.com/igggame/nebulas-go@v2.1.0+incompatible/cmd/neb/misccmd.go (about)

     1  // Copyright (C) 2017 go-nebulas authors
     2  //
     3  // This file is part of the go-nebulas library.
     4  //
     5  // the go-nebulas library is free software: you can redistribute it and/or modify
     6  // it under the terms of the GNU General Public License as published by
     7  // the Free Software Foundation, either version 3 of the License, or
     8  // (at your option) any later version.
     9  //
    10  // the go-nebulas library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  // GNU General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU General Public License
    16  // along with the go-nebulas library.  If not, see <http://www.gnu.org/licenses/>.
    17  //
    18  
    19  package main
    20  
    21  import (
    22  	"fmt"
    23  	"os"
    24  	"runtime"
    25  
    26  	"github.com/nebulasio/go-nebulas/net"
    27  	"github.com/urfave/cli"
    28  )
    29  
    30  var (
    31  	versionCommand = cli.Command{
    32  		Action:    MergeFlags(_version),
    33  		Name:      "version",
    34  		Usage:     "Print version numbers",
    35  		ArgsUsage: " ",
    36  		Category:  "MISC COMMANDS",
    37  	}
    38  	licenseCommand = cli.Command{
    39  		Action:    MergeFlags(_license),
    40  		Name:      "license",
    41  		Usage:     "Display license information",
    42  		ArgsUsage: " ",
    43  		Category:  "MISC COMMANDS",
    44  	}
    45  )
    46  
    47  func _version(ctx *cli.Context) error {
    48  	neb, err := makeNeb(ctx)
    49  	if err != nil {
    50  		return err
    51  	}
    52  
    53  	fmt.Println("Version:", version)
    54  	if commit != "" {
    55  		fmt.Println("Git Commit:", commit)
    56  	}
    57  	fmt.Println("Protocol Versions:", net.NebProtocolID)
    58  	fmt.Println("Protocol ClientVersion:", net.ClientVersion)
    59  	fmt.Printf("Chain Id: %d\n", neb.Config().Chain.ChainId)
    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(`The preferred license for the Nebulas Open Source Project is the GNU Lesser General Public License Version 3.0 (“LGPL v3”), which is commercial friendly, and encourage developers or companies modify and publish their changes.
    69  
    70  	However, we also aware that big corporations is favoured by other licenses, for example, Apache Software License 2.0 (“Apache v2.0”), which is more commercial friendly. For the Nebulas Team, we are very glad to see the source code and protocol of Nebulas is widely used both in open source applications and non-open source applications.
    71  
    72  	In this way, we are still considering the license choice, which kind of license is the best for nebulas ecosystem. We expect to select one of the LGPL v3, the Apache v2.0 or the MIT license. If the latter is chosen, it will come with an amendment allowing it to be used more widely.`)
    73  	return nil
    74  }