github.com/theQRL/go-zond@v0.2.1/cmd/gzond/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/theQRL/go-zond/internal/version" 26 "github.com/theQRL/go-zond/params" 27 "github.com/urfave/cli/v2" 28 ) 29 30 var ( 31 // TODO(now.youtrack.cloud/issue/TGZ-17) 32 VersionCheckUrlFlag = &cli.StringFlag{ 33 Name: "check.url", 34 Usage: "URL to use when checking vulnerabilities", 35 Value: "https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json", 36 } 37 VersionCheckVersionFlag = &cli.StringFlag{ 38 Name: "check.version", 39 Usage: "Version to check", 40 Value: version.ClientName(clientIdentifier), 41 } 42 versionCommand = &cli.Command{ 43 Action: printVersion, 44 Name: "version", 45 Usage: "Print version numbers", 46 ArgsUsage: " ", 47 Description: ` 48 The output of this command is supposed to be machine-readable. 49 `, 50 } 51 versionCheckCommand = &cli.Command{ 52 Action: versionCheck, 53 Flags: []cli.Flag{ 54 VersionCheckUrlFlag, 55 VersionCheckVersionFlag, 56 }, 57 Name: "version-check", 58 Usage: "Checks (online) for known Gzond security vulnerabilities", 59 ArgsUsage: "<versionstring (optional)>", 60 Description: ` 61 The version-check command fetches vulnerability-information from https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json, 62 and displays information about any security vulnerabilities that affect the currently executing version. 63 `, 64 } 65 licenseCommand = &cli.Command{ 66 Action: license, 67 Name: "license", 68 Usage: "Display license information", 69 ArgsUsage: " ", 70 } 71 ) 72 73 func printVersion(ctx *cli.Context) error { 74 git, _ := version.VCS() 75 76 fmt.Println(strings.Title(clientIdentifier)) 77 fmt.Println("Version:", params.VersionWithMeta) 78 if git.Commit != "" { 79 fmt.Println("Git Commit:", git.Commit) 80 } 81 if git.Date != "" { 82 fmt.Println("Git Commit Date:", git.Date) 83 } 84 fmt.Println("Architecture:", runtime.GOARCH) 85 fmt.Println("Go Version:", runtime.Version()) 86 fmt.Println("Operating System:", runtime.GOOS) 87 fmt.Printf("GOPATH=%s\n", os.Getenv("GOPATH")) 88 fmt.Printf("GOROOT=%s\n", runtime.GOROOT()) 89 return nil 90 } 91 92 func license(_ *cli.Context) error { 93 fmt.Println(`Gzond is free software: you can redistribute it and/or modify 94 it under the terms of the GNU General Public License as published by 95 the Free Software Foundation, either version 3 of the License, or 96 (at your option) any later version. 97 98 Gzond is distributed in the hope that it will be useful, 99 but WITHOUT ANY WARRANTY; without even the implied warranty of 100 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 101 GNU General Public License for more details. 102 103 You should have received a copy of the GNU General Public License 104 along with gzond. If not, see <http://www.gnu.org/licenses/>.`) 105 return nil 106 }