This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Added more information to the version command (#688)
* Added more information to the version command * Added commit hash info * Added build timestamp info * Added git branch info
- Loading branch information
1 parent
7ada10f
commit f982111
Showing
4 changed files
with
40 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
package version | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"github.com/0xPolygon/polygon-edge/command/helper" | ||
) | ||
|
||
type VersionResult struct { | ||
Version string `json:"version"` | ||
Version string `json:"version"` | ||
Commit string `json:"commit"` | ||
Branch string `json:"branch"` | ||
BuildTime string `json:"buildTime"` | ||
} | ||
|
||
func (r *VersionResult) GetOutput() string { | ||
return r.Version | ||
var buffer bytes.Buffer | ||
|
||
buffer.WriteString("\n[VERSION INFO]\n") | ||
buffer.WriteString(helper.FormatKV([]string{ | ||
fmt.Sprintf("Release version|%s", r.Version), | ||
fmt.Sprintf("Git branch|%s", r.Branch), | ||
fmt.Sprintf("Commit hash|%s", r.Commit), | ||
fmt.Sprintf("Build time|%s", r.BuildTime), | ||
})) | ||
|
||
return buffer.String() | ||
} |
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