parent
326c642a2a
commit
add9c42c21
|
|
@ -24,9 +24,9 @@ func printInfo() {
|
|||
const sectionFmt = "%-15s "
|
||||
|
||||
printLogo(color.Cyan)
|
||||
printTuple(sectionFmt, "Configuration", config.K9sConfigFile)
|
||||
printTuple(sectionFmt, "Logs", config.K9sLogs)
|
||||
printTuple(sectionFmt, "Screen Dumps", config.K9sDumpDir)
|
||||
printTuple(sectionFmt, "Configuration", config.K9sConfigFile, color.Cyan)
|
||||
printTuple(sectionFmt, "Logs", config.K9sLogs, color.Cyan)
|
||||
printTuple(sectionFmt, "Screen Dumps", config.K9sDumpDir, color.Cyan)
|
||||
}
|
||||
|
||||
func printLogo(c color.Paint) {
|
||||
|
|
|
|||
|
|
@ -8,26 +8,38 @@ import (
|
|||
)
|
||||
|
||||
func versionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
var silent bool
|
||||
|
||||
command := cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version/build info",
|
||||
Long: "Print version/build information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
printVersion()
|
||||
printVersion(silent)
|
||||
},
|
||||
}
|
||||
|
||||
command.PersistentFlags().BoolVarP(&silent, "short", "s", false, "Simplified print version for resumed printing")
|
||||
|
||||
return &command
|
||||
}
|
||||
|
||||
func printVersion() {
|
||||
func printVersion(silent bool) {
|
||||
const secFmt = "%-10s "
|
||||
var outputColor color.Paint
|
||||
|
||||
printLogo(color.Cyan)
|
||||
printTuple(secFmt, "Version", version)
|
||||
printTuple(secFmt, "Commit", commit)
|
||||
printTuple(secFmt, "Date", date)
|
||||
if silent {
|
||||
outputColor = color.White
|
||||
} else {
|
||||
outputColor = color.Cyan
|
||||
printLogo(outputColor)
|
||||
}
|
||||
printTuple(secFmt, "Version", version, outputColor)
|
||||
printTuple(secFmt, "Commit", commit, outputColor)
|
||||
printTuple(secFmt, "Date", date, outputColor)
|
||||
}
|
||||
|
||||
func printTuple(format, section, value string) {
|
||||
fmt.Printf(color.Colorize(fmt.Sprintf(format, section+":"), color.Cyan))
|
||||
func printTuple(format, section, value string, outputColor color.Paint) {
|
||||
fmt.Printf(color.Colorize(fmt.Sprintf(format, section+":"), outputColor))
|
||||
fmt.Println(color.Colorize(value, color.White))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue