-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
58 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/celestiaorg/celestia-node/nodebuilder/node" | ||
) | ||
|
||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Show information about the current binary build", | ||
Args: cobra.NoArgs, | ||
Run: printBuildInfo, | ||
} | ||
|
||
func printBuildInfo(_ *cobra.Command, _ []string) { | ||
buildInfo := node.GetBuildInfo() | ||
fmt.Printf("Semantic version: %s\n", buildInfo.SemanticVersion) | ||
fmt.Printf("Commit: %s\n", buildInfo.LastCommit) | ||
fmt.Printf("Build Date: %s\n", buildInfo.BuildTime) | ||
fmt.Printf("System version: %s\n", buildInfo.SystemVersion) | ||
fmt.Printf("Golang version: %s\n", buildInfo.GolangVersion) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
package node | ||
|
||
// BuildInfo stores all necessary information for the current build. | ||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
buildTime string | ||
lastCommit string | ||
semanticVersion string | ||
|
||
systemVersion = fmt.Sprintf("%s/%s", runtime.GOARCH, runtime.GOOS) | ||
golangVersion = runtime.Version() | ||
) | ||
|
||
// BuildInfo represents all necessary information about current build. | ||
type BuildInfo struct { | ||
BuildTime string | ||
LastCommit string | ||
SemanticVersion string | ||
SystemVersion string | ||
GolangVersion string | ||
} | ||
|
||
// GetBuildInfo returns information about current build. | ||
func GetBuildInfo() *BuildInfo { | ||
return &BuildInfo{ | ||
buildTime, | ||
lastCommit, | ||
semanticVersion, | ||
systemVersion, | ||
golangVersion, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters