Set the output format for bee version

This adds the ability to set the output format (using -o flag) of bee
version command. It supports both JSON and YAML formats.
This commit is contained in:
Faissal Elamraoui
2016-12-24 14:51:14 +01:00
parent d8b9d96d84
commit 059df76c3e
3 changed files with 56 additions and 19 deletions

View File

@ -8,7 +8,8 @@ import (
"text/template"
)
type vars struct {
// RuntimeInfo holds information about the current runtime.
type RuntimeInfo struct {
GoVersion string
GOOS string
GOARCH string
@ -45,7 +46,7 @@ func show(out io.Writer, content string) {
logger.Fatalf("Cannot parse the banner template: %s", err)
}
err = t.Execute(out, vars{
err = t.Execute(out, RuntimeInfo{
getGoVersion(),
runtime.GOOS,
runtime.GOARCH,