Skip to content

Commit

Permalink
Improve OS display
Browse files Browse the repository at this point in the history
  • Loading branch information
maetthu committed Feb 11, 2020
1 parent 5dd8a11 commit 0a061e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion greeter.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ func main() {

if info, err := host.Info(); err == nil {
fmt.Printf("%s%s\n", title("Host"), info.Hostname)
fmt.Printf("%s%s (%s %s)\n", title("OS"), info.KernelVersion, info.Platform, info.PlatformVersion)

kernel := strings.Trim(
fmt.Sprintf("%s %s", strings.Title(info.OS), info.KernelVersion),
" ",
)

platform := strings.Trim(
fmt.Sprintf("%s %s", strings.Title(info.Platform), info.PlatformVersion),
" ",
)

fmt.Printf("%s%s (%s)\n", title("OS"), kernel, platform)

bootime := time.Unix(int64(info.BootTime), 0)
uptime := time.Duration(info.Uptime) * time.Second
Expand Down

0 comments on commit 0a061e7

Please sign in to comment.