Dan Anglin
cc5e3f0044
- Move the build and application information to the internal info package. - Move the user agent and redirect URI string to the internal client package.
31 lines
848 B
Go
31 lines
848 B
Go
package printer
|
|
|
|
import (
|
|
"strings"
|
|
"text/tabwriter"
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/info"
|
|
)
|
|
|
|
func (p Printer) PrintVersion(showFullVersion bool) {
|
|
if !showFullVersion {
|
|
printToStdout("Enbas " + info.BinaryVersion + "\n")
|
|
|
|
return
|
|
}
|
|
|
|
var builder strings.Builder
|
|
|
|
builder.WriteString(p.headerFormat("Enbas") + "\n\n")
|
|
|
|
tableWriter := tabwriter.NewWriter(&builder, 0, 4, 1, ' ', 0)
|
|
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Version:") + "\t" + info.BinaryVersion + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Git commit:") + "\t" + info.GitCommit + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Go version:") + "\t" + info.GoVersion + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Build date:") + "\t" + info.BuildTime + "\n"))
|
|
|
|
tableWriter.Flush()
|
|
|
|
printToStdout(builder.String())
|
|
}
|