Dan Anglin
84091f398d
Summary: - Created a custom CLI schema for Enbas which will act as the Source of Truth for code and document generation. - Created a code generator which uses the schema to generate the executor definitions and code in the internal usage package. Changes: - Created the Enbas CLI schema as the Source of Truth for Enbas. - Created the code generator that generates the executor definitions and code in the usage package. - Regenerated the executor definitions using the code generator. - Moved the custom flag value types to the new internal flag package. - Created a new flag value type for the bool pointer to replace the flag.BoolFunc() used for the sensitive and no-color flags. - Moved the version and build variables to the new internal version package to simplify the version executor. - Created a new usage package and moved the usage functions there. - Changed the type of the account-name flag from string to the internal StringSliceValue type.
31 lines
866 B
Go
31 lines
866 B
Go
package printer
|
|
|
|
import (
|
|
"strings"
|
|
"text/tabwriter"
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/version"
|
|
)
|
|
|
|
func (p Printer) PrintVersion(showFullVersion bool) {
|
|
if !showFullVersion {
|
|
printToStdout("Enbas " + version.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" + version.BinaryVersion + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Git commit:") + "\t" + version.GitCommit + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Go version:") + "\t" + version.GoVersion + "\n"))
|
|
_, _ = tableWriter.Write([]byte(p.fieldFormat("Build date:") + "\t" + version.BuildTime + "\n"))
|
|
|
|
tableWriter.Flush()
|
|
|
|
printToStdout(builder.String())
|
|
}
|